put it in replicatedstorage, I always have a folder called “Remotes” just to organize, If you want to fire one client then use fireclient with the player as the first parameter, If you want to yield until the client gives a response then use a remote function.
The reason behind this is because both server scripts, and local scripts can access this. That way you don’t have any problems with where you are putting things, and its more organized because ReplicatedStorage is practically designed for remote events.
Bindable events are used to communicate between 2 similar type of scripts like serverscript to serverscript,but wont work in server → local.I preffer using remote events or remote functions which only works server-> local or local-> server.
local ReplicatedStorage = game:WaitForChild("ReplicatedStorage")
local Event = ReplicatedStorage.RemoteFolder:WaitForChild("RemoteEvent")
function Testing()
Event:FireAllClient()
print("It has been fired!")
--More code
end
wait(5)
Testing()
LocalScript:
local ReplicatedStorage = game:WaitForChild("ReplicatedStorage")
local Event = ReplicatedStorage.RemoteFolder:WaitForChild("RemoteEvent")
function CameraChange()
--code here
end
Event.OnClientEvent:Connect(CameraChange)
I’m noticing an issue with the code here. You’re using Event:FireClient() but nowhere did you use the Player as the first parameter so that the server knows which client to trigger the event on.
You can use FireAllClients() without a Player argument. But this will trigger every client, so if you have data you don’t want a specific client to get access to it’s best to use a Player parameter using the Player Instance as the argument.
My game is a single player game (FNAF fan game). Basically the script is one of the characters and when you die a jumpscare happens (obviously). So it doesn’t matter much.