When I press a button, I want everyone to teleport to a spot in my game, but I don’t know how to do that. I created my script based off of the script I used to teleport a player between parts when they touched one in a test game I made.
local player = game.Players.LocalPlayer
local TeleportPad = game.Workspace.WoodObbyTeleport
game.ReplicatedStorage.Cutscene3.OnClientEvent:Connect(function()
player:MoveTo(TeleportPad.Position)
end)
I’ve looked up tutorials here and on youtube but none are activated with a ClickDetector or when a RemoteEvent fires.
game.Workspace.CutsceneButton3.CutsceneButton3.ClickDetector.MouseClick:Connect(function()
for _, Player in pairs(game.Players:GetPlayers()) do
Player.Character.HumanoidRootPart.CFrame = game.Workspace.WoodObbyTeleport.CFrame
end
end)
Hey! If it’s not already solved, this is what you can try:
If you want to move all players at the same time, I suggest you use a server script. For that, you either use a bindable event instead of the remote event you use now, or you can implement the code directly in the cutscene script.
local TeleportPad = game:GetService("Workspace"):WaitForChild("WoodObbyTeleport") -- MAKE SURE THIS IS A PART
local Players = game:GetService("Players")
game:GetService("ReplicatedStorage"):WaitForChild("Cutscene3").OnServerEvent:Connect(function() -- YOU CAN USE A BINDABLE EVENT IF YOU FIRE IT FROM THE SERVER AS WELL
for i, v in pairs(Players:GetPlayers()) do
v.Character.HumanoidRootPart.Position = TeleportPad.Position
end
end)