Help with script

Hello everyone! I currently am in a bit of trouble right now. so basically i have this Player script in each player in my game… its for a cutscene.
But anyways, i was wondering how i could enable the script within each player at the same time…
Heres my example down here.
snippet
So basically i want to enable all of them within each player at the same time.
-Please feel free to comment any questions you might have.

1 Like

I don’t know if this is a good way. I would probably do it like this: Fire a remote event to all clients(RemoteEvent:FireAllClients()). Then I would have a local script (player manager) inside each player listening for the event. When the event gets fired, you should enable the local script from the player manager. Tell me if you think this is not a good way and if you need me to explain more

1 Like

Sorry about this but could u explain how todo that? I’m not familiar with remotes yet… if you cant its fine

Instead of enabling a script at the same time, have your LocalScript listen for a RemoteEvent. In your LocalScript, you could have something like this:

-- LocalScript (not disabled)
-- Make a RemoteEvent in ReplicatedStorage

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remote = ReplicatedStorage:WaitForChild("RemoteEvent")

remote.OnClientEvent:Connect(function()
    -- your cutscene code
end)

Then in a ServerScript, you can fire the RemoteEvent:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remote = ReplicatedStorage.RemoteEvent

-- When you're ready to fire the RemoteEvent...
remote:FireAllClients()

Enabling/Disabling a script during runtime is bad practice. Always use RemoteEvents, RemoteFunctions, BindableEvents, and BindableFunctions whenever possible.

1 Like

Alrighty! thanks alot for clarifying the whole remote thingys… ill be sure to learn more about remote events

2 Likes