Long post and I'm still new to scripting. So,
I was following a tutorial (Link)(Might be an outdated method) I decided to follow this tutorial to make a damage system. He puts the Remote Function in the Local script as a child he uses and he adds a normal script as a child of the Remote Function.
Followed it . It didn't do any damage, so I thought to change the script to use a Remote Function in the Replicated Storage.
Local Script works fine and no error, but the script I used to activate the Remote function can no long use LocalPlayer. Is there a replacement for this Also please let me know if I need to change the way I need to do this.
local rs = game:GetService("ReplicatedStorage") local punching = rs:WaitForChild("ThePunch") Enabled = true punching.OnServerEvent:Connect(function(Action, Player, numb1) local player = game.Players.LocalPlayer local char = player.Character if Enabled == false then return end if Action == "Combat" then for i, v in pairs(workspace:children()) do if v:FindFirstChild("Humanoid") and v:FindFirstChild("HumanoidRootPart") and v:FindFirstChild("Debounce") and v ~= char then if (v.HumanoidRootPart.Position-char.HumanoidRootPart.Position).magnitue <= 5 then v.Humanoid:TakeDamage(5) end end end end end)
When writing code on the server, the script will not automatically know what "LocalPlayer" means, Since your connected function already has a variable called "Player" I would advise using that to get to the player instead of the variable you made on line 7. Hope this helps