Why my eletrocute system isn't working?

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 :frowning:

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)

If anyone could help i would appreciate.

damn u need to use :WaitForChild()

um, is this gonna solve my problem? i’m gonna try it then.

first of all are there any errors in the output, pardon me

1 Like

nope, still not working. man i really thought it would work because of a simple and stupid thing, but i guess… no :skull:

pretty sure remotefunction need to use waitforchild like remoteevents like what i used to remember

oh wait, there’s actually a thing here, look:

OnInvoke is a callback member of BindableFunction; you can only set the callback value, get is not available

@How4rdy what does this mean?

some little chars as always

oooh its a bindable function theres a devforum post about this i think from what ive remembered it needs to use :Invoke() or smth like that

but, for some reason i used the invoke thingy, but it still does not worked.

1 Like

oooh i see now, i need to use a remote function not a bindable function but lemme see if it works

yeah man because as it named, bindable function are function that could be bindable

bruh, the same error but now it’s different it’s now instead of “oninvoke” it’s “onserverinvoke”

I don’t think BindableEvents can cross the client/server boundry like that.

Yes:

– Server To Server
– Client To Client

No:

– Server To Client
– Client To Server

To cross the boundry you need a RemoteEvent.

1 Like

YAY!!! IT WORKED, Thanks oof! it really helped me!

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:

Thanks, but i think i will still use remote events. Thanks for suggesting though

yeah no problem, char limits brahh

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.