I wasn't too sure where to start so all I've tried is this.
function onClick(ply) local c=game.Players:children() for i=1, #c do game.Soundscape.CutsceneLocalScript:Clone().Parent = c[i].Backpack end end script.Parent.MouseButton1Click:connnect(onClick)
How do I make this work? Or is there another, easier way to make the local script play for everyone at once?
I would do what hiim said, but to do exactly what you asked use ipairs.
Example:
script.Parent.MouseButton1Click:connect(function() for i,v in ipairs(game.Players:GetChildren()) do if v:FindFirstChild('Backpack') then clone = (ur localscript):Clone() clone.Parent = v.Backpack end end end)
You can use a server to client RemoteEvent and the FireAllClients method. Put a LocalScript in StarterPlayer > StarterCharacterScripts. Put a Script in ServerScriptService.
In your LocalScript put this in to test.
local ReplicatedStorage = game:GetService("ReplicatedStorage") local RemoteEvent = ReplicatedStorage:WaitForChild("same_time") RemoteEvent.OnClientEvent:connect(function() print("Cutscene fired for ", game.Players.LocalPlayer) end)
In your script put this in to test
local ReplicatedStorage = game:GetService('ReplicatedStorage') local Remote_event = Instance.new("RemoteEvent") Remote_event.Name = 'same_time' Remote_event.Parent = ReplicatedStorage; -- Make sure there's a player to recieve it, this is just for testing purposes, comment out later. game:GetService('Players').PlayerAdded:wait() Remote_event:FireAllClients()
Put the local script into StarterPlayer > StarterPlayerScripts.