I'm Doing a Simon Says Game, So The Script Chooses a Random Player to be Simon, But I'm Struggling in how to Teleport Simon to a different place, I Want to Teleport Only Simon, I'm Trying CFrame but it doesn't work.
local s = script.Stat t= 0 while true do t= 8 repeat t= t-1 s.Value = "Game Starting in "..t wait(1) until t == 0 target = CFrame.new(102, 3.5, -465) for i, player in pairs(game.Players:GetChildren()) do player.Character.UpperTorso.CFrame = target end wait(1) t= 5 repeat t= t-1 s.Value = "Choosing Simon in "..t wait(1) until t == 0 local randomPlayer = game.Players:GetPlayers() [math.random(1,#game.Players:GetPlayers())] print(randomPlayer.Name) randomPlayer.TeamColor = BrickColor.new("Black") simonpl = CFrame.new(182, 2.5, -477) randomPlayer.CFrame = simonpl end print("this is working") end print("This Is Simon") print("game ended")
Edited script:
local s = script.Stat t= 0 while true do t= 8 repeat t= t-1 s.Value = "Game Starting in "..t wait(1) until t == 0 target = CFrame.new(102, 3.5, -465) for i, player in pairs(game.Players:GetChildren()) do player.Character.HumanoidRootPart.CFrame = target ---- end wait(1) t= 5 repeat t= t-1 s.Value = "Choosing Simon in "..t wait(1) until t == 0 local randomPlayer = game.Players:GetPlayers() [math.random(1,#game.Players:GetPlayers())] print(randomPlayer.Name) randomPlayer.TeamColor = BrickColor.new("Black") simonpl = CFrame.new(182, 2.5, -477) randomPlayer.Character.HumanoidRootPart.CFrame = simonpl ---- end print("this is working") end print("This Is Simon") print("game ended")
In line 16 replaced UpperTorso with HumanoidRootPart, its a better practice to use this body part to move the character around.
In line 32 you should reference the character's HumanoidRootPart, not the player.