This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Simple shooting mechanic (local script example) | |
| local player = game.Players.LocalPlayer | |
| local mouse = player:GetMouse() | |
| mouse.Button1Down:Connect(function() | |
| print("Player fired!") | |
| local rayOrigin = workspace.CurrentCamera.CFrame.Position | |
| local rayDirection = (mouse.Hit.Position - rayOrigin).Unit * 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local Players = game:GetService("Players") | |
| local LP = Players.LocalPlayer | |
| local RS = game:GetService("ReplicatedStorage") | |
| -- This function acts like a "Spy" to find the hidden hit event | |
| local function findHitEvent() | |
| -- Scans for any remote with "hit" or "damage" in its name | |
| for _, v in pairs(RS:GetDescendants()) do | |
| if v:IsA("RemoteEvent") and (v.Name:lower():find("hit") or v.Name:lower():find("damage")) then | |
| return v |