I’m making a game with my friend, and you know that you can’t change humanoid’s walkspeed’s in localscripts, right? But for some reason it doesn’t work!
I need some power boxes to eletrocute a purple guy (no, not purple guy from fnaf)
but it doesn’t work
Here’s my three scripts:
Powerbox Server:
local Event = game.ReplicatedStorage.Events.EletrocuteViolet
local Prompt = script.Parent.ProximityPrompt
Prompt.Triggered:Connect(function(player)
Event:FireAllClients()
script.Parent.Shock:Play()
end)
Eletrocute server:
local Eletrocute = game:GetService("ReplicatedStorage").Events.EletrocuteViolet
local EletrocuteBindable = script.Parent.Eletrocute
local ShockTime = 20 -- Valor de teste, por isso é 20
EletrocuteBindable.OnInvoke:Connect(function()
script.Parent.Parent.Humanoid.WalkSpeed = 0
script.Parent.DamageTag.Damage.Value = 0
task.wait(ShockTime)
script.Parent.Parent.Humanoid.WalkSpeed = 22
script.Parent.DamageTag.Damage.Value = 13
end)
And finally, eletrocute client:
local Eletrocute = game:GetService("ReplicatedStorage").Events.EletrocuteViolet
local EletrocuteBindable = script.Parent.Eletrocute
Eletrocute.OnClientEvent:Connect(function()
EletrocuteBindable:Invoke()
end)
btw u could use both remote events and remote functions but remote events are better, turns out if u want to use remote function u just need to make it a function like this: