Local script to normal script Bindable event

How do I fire a bindable event from local script into a normal script, I tried :Fire() but it doesn’t work can anyone help me? thanks!

local script:

AnaFrame.Isik.MouseButton1Click:Connect(function(plr)
	Event:Fire(plr)
end)

normal script:

model = script.Parent
wait(0.5)
currentP = "Off"
script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr)
	if script.Parent.Lon.Value == 0 then
		script.Parent.Lon.Value = 1
	elseif
		script.Parent.Lon.Value == 1 then
		script.Parent.Lon.Value = 0
		
end
end)

You can’t. Bindale events can only go Client > Client or Server > Server. You can replace them with REMOTE events. Use the :FireServer() method on the client, and recieve it with the .OnServerEvent() event.

2 Likes

So I can’t make a event that will fire from local script to normal script???

Use remote events as @Bikereh said

So I gotta use :FireClient() ???

Instead of BindableEvents, use RemoteEvents.

Notes: replace :Fire() with :FireServer() and .Event with .OnServerEvent. Also, make sure to always set the first parameter in .OnServerEvent to player which is the player that fired the event.

From LocalScript to Script, you have to use :FireServer() and .OnServerEvent:Connect(function(player).
From Script to LocalScript, you have to use :FireClient(player) and .OnClientEvent

Documentation

1 Like

Okay thank you!!! this helped

From server to client use:

SERVER: :FireClient(PLAYER)
Client: .OnClientEvent() <-- player is not sharing

From client to server use:

SERVER: .OnServerEvent(PLAYER) <-- returns player automatically (you dont need to share it)
Client: :FireServer()
1 Like

If you want to share smth from server to server or from client to client:
Use bindable event

also don’t use _G (global functions) cus i figured out it’s very slow to execute

Yes, I see it’s very slow but it gets the job done are there any faster ways by any chance???

Don’t use _G use modules for shared functions

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