Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is this script not teleporting any player?

I'm trying to make that the players will teleport when ChosenGamemode's text is "Free For All Was Chosen" or "Death Match Was Chosen" but it doesn't teleport any player and it doesn't change the text back to "Gamemode Was Chosen" and it doesn't disappear, It's because it doesn't make it through the player teleportation.

[Edit: I have no errors in output]

Script:

for i, players in pairs(game.Players:GetChildren()) do
	local PlrGui = players.PlayerGui
	local RoundSystem = PlrGui.RoundSystem
	local Frame = RoundSystem.ChosenGamemode
	local ChosenGamemode = Frame.ChosenGamemode
	
	local Target = CFrame.new(0, 50, 0)
	
	while Frame.Visible == true do
		wait(0.1)
		
		if ChosenGamemode.Text == "Free For All Was Chosen" then
			wait(4)
			
      		-- Teleport Players
			
			players.Character.HumanoidRootPart.CFrame = Target + Vector3.new(0, i * 5, 0)
			
			ChosenGamemode.Text = "Gamemode Was Chosen"
			Frame.Visible = false
		end
		
		if ChosenGamemode.Text == "Death Match Was Chosen" then
			wait(4)
			
      		-- Teleport Players
			
			players.Character.HumanoidRootPart.CFrame = Target + Vector3.new(0, i * 5, 0)
			
			ChosenGamemode.Text = "Gamemode Was Chosen"
			Frame.Visible = false
		end
	end
end

(This script is a local script and the script is kinda glitched because it's long)

I would really appreciate it if you help me, Plus I'll accept your answer and we both make reputation from that.

Thanks, MajinBluee

2 comments

0

Why in a LocalScript? Use a ServerScript instead...

0

Sorry, But this didn't help me. But thanks for being kind and helping me with my problem!

1 answer

You can't add Vector3s to CFrames on lines 17 and 28. You would have to do

Target*CFrame.new(0, i * 5, 0)

Hope this helps.

2 comments

0

Sorry, But this didn't help me. But thanks for being kind and helping me with my problem!

0

Not downvoting, but your statement is wrong. You can actually construct a CFrame by summing up a CFrame and a Vector3. http://wiki.roblox.com/index.php?title=CFrame#Operators

This discussion is preserved as it was. New answers, comments, and votes are closed.