{"id":"bondhemlig/clientcast-fork","name":"clientcast-fork","scope":"bondhemlig","platform":"roblox","description":"Mirrored from the Wally registry.","version":"0.1.0","latest":"0.1.0","versions":["0.1.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":["License identified from the packaged LICENSE file; the manifest declared none."],"licenseVerified":true,"dependencies":{},"integrity":"28a224a3ab4206501976ca7c606e8d687227f9787e7c3f5e81b3489e4b5058c3","likes":0,"downloads":0,"install":"forest install bondhemlig/clientcast-fork","url":"https://forest.dev/p/roblox/bondhemlig/clientcast-fork","files":"https://api.forest.dev/ai/package/roblox/bondhemlig/clientcast-fork/files","readme":"## Table of Contents\r\n- [Introduction](https://pysephwasntavailable.github.io/ClientCast#introduction)\r\n- [Example Usage](https://pysephwasntavailable.github.io/ClientCast#example-usage)\r\n- [Setup](https://pysephwasntavailable.github.io/ClientCast#setup)\r\n- [Links](https://pysephwasntavailable.github.io/ClientCast#links)\r\n\r\n## Introduction\r\nClientCast is a simple and elegant solution to handling weapon hitboxes. This module is written with efficiency, simplicity and customizability in mind. This module is meant to be bareboned. ClientCast relies solely on raycasts to provide with hitbox data, and as such is not only extremely efficient, but also provides detailed information on where and when it hit an object. If you would like to get extra data or add your own functions, the best solution would be to simply wrap the object and add your own methods onto it.\r\n\r\nThe main forte of ClientCast lies in the fact that you can easily communicate with the client, letting the client handle all the calculations and then have the server be notified whenever the client intersects something. This allows the server to have to calculate way less and also take into account for a player's ping or delay, providing all players a lag-free experience.\r\n\r\n## Example Usage\r\n### Making a part kill players\r\nSimply parent the ClientCast folder to ServerStorage and run this script on the server:\r\n```lua\r\nlocal ClientCast = require(game.ServerStorage.ClientCast)\r\n\r\nlocal KillPart = Instance.new('Part')\r\nKillPart.Anchored = true\r\nKillPart.CanCollide = false\r\nKillPart.CFrame = CFrame.new(0, 1, 0)\r\nKillPart.Parent = workspace\r\n\r\nfunction GenerateAttachment(Position)\r\n\tlocal Attachment = Instance.new('Attachment')\r\n\tAttachment.Name = 'DmgPoint'\r\n\tAttachment.Position = Position\r\n\tAttachment.Parent = KillPart\r\nend\r\n\r\nfor X = -2, 2 do\r\n\tGenerateAttachment(Vector3.new(X, Y, Z))\r\nend\r\n\r\nlocal ClientCaster = ClientCast.new(KillPart, RaycastParams.new())\r\nlocal Debounce = {}\r\nClientCaster.HumanoidCollided:Connect(function(RaycastResult, HitHumanoid)\r\n\tif Debounce[HitHumanoid] then\r\n\t\treturn\r\n\tend\r\n\tDebounce[HitHumanoid] = true\r\n\tprint('Ow!')\r\n\tHitHumanoid:TakeDamage(10)\r\n\t\r\n\twait(0.5)\r\n\tDebounce[HitHumanoid] = false\r\nend)\r\nClientCaster:Start()\r\n```\r\n### Note: This will not work until the part starts moving around.\r\n[![asciicast](https://cdn.discordapp.com/attachments/623866531138371612/781248496979804220/unknown.png)](https://cdn.discordapp.com/attachments/623866531138371612/781247798589915166/bqa6Y6hmbN.mp4)\r\n\r\n## Setup\r\n\r\nTo start using this module, simply put attachments called ``DmgPoint`` (name is customizable in the ``Settings`` table at the top of the ``ClientCast`` ModuleScript) inside the object, and then create a ClientCaster object, with it's ``Object`` set to your hitbox.\r\nExample:\r\n```lua\r\n-- Call module\r\nlocal ClientCast = require(PATH.ClientCast)\r\n-- Create ClientCaster object\r\nlocal Caster = ClientCast.new(workspace.Part, RaycastParams.new())\r\n\r\n-- Connect callback to 'Collided' event\r\nCaster.Collided:Connect(print)\r\n-- Set owner of ClientCaster, who will be the one to calculate collisions.\r\n-- You can skip this if you want the server to be the owner.\r\nCaster:SetOwner(Player)\r\n-- Start detecting collisions\r\nCaster:Start()\r\n```\r\n\r\n## Links\r\n\r\n- [Example Usage](https://pysephwasntavailable.github.io/ClientCast#example-usage)\r\n- [Setup](https://pysephwasntavailable.github.io/ClientCast#setup)\r\n- [ClientCast API](https://pysephwasntavailable.github.io/ClientCast/api/ClientCast)","readmeTruncated":false}