Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Punch script only effects anything on local players screen?

Asked by 6 years ago

I have attempted to fix it myself by putting it into a server script and testing outside of studio but im stumped currently.

01local Player = game.Players.LocalPlayer
02local Mouse = Player:GetMouse()
03 
04 
05debounce = false
06enabled = true
07Mouse.Button1Down:Connect(function()
08    local enabled = true
09    local character = Player.Character
10    local hitbox = character:FindFirstChild("RightHand")
11    local humanoid = character:FindFirstChild("Humanoid")
12    local animation = Instance.new("Animation")
13    animation.AnimationId = "rbxassetid://2701542598"
14    local animation2 = Instance.new("Animation")
15    animation2.AnimationId = "rbxassetid://2701542598"
View all 70 lines...

What the code is supposed to do is have the character run an animation and see if the right hand hits anything if it hit a humanoid it does damage. It seems to work on the surface but when i test it with multiple players it only changes anything on that players screen. Even if i kill someone they only appear dead on my screen vice versa.

The code is in a local script in StarterGui I would greatly appreciate for someone to help find the errors in the script

1
Changing properties such as the humanoid's health on a localscript will only affect the client due to filtering enabled. You sould use Remote Events/Functions to go about this: https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events GoldAngelInDisguise 297 — 6y
0
alright thank you steadfast123jay 2 — 6y
0
it fixed the issue thank you very much steadfast123jay 2 — 6y

Answer this question