I need to use events to make one of my games, but it doesn’t really work.
I basically created a proximity prompt and a script basically do this:
ProxmityPromt.Triggered:Connect(function(player)
print(1)
BindableEvent:Fire(player)
print(2)
end)
And the LocalScript picking it up would do this:
BindableEvent.Event:Connect(function(player: Player)
print(2)
end)
The first script outputted ‘1’ and ‘2’, but nothing afterwards. What did I do wrong?
kittyPGR
(KittyPlays)
April 1, 2023, 5:56am
#2
umm there’s noting wrong in the script, can you send the complete second script…
BindableEvents only work for the same type of script (Local Script > Local Script, or Server Script > Server Script).
You have to use RemoteEvents to send events from Server to Client and vice versa.
Changed that and used :FireAllClients(), but still didn’t work. Should I start with the LocalScript and then the script?
you should use a server script to detect the prompt being used:
server script:
prompt.Triggered:Connect(function(player)
remote:FireAllClients(player)
end)
client script:
remote.OnClientEvent:Connect(function(player)
print(player, "Triggered the prompt")
end)