I have three problems: 1. I can't teleport players correctly, sometimes they still spawn in the original spawn point and would take several clicks before he teleports into the right one.
Debounce won't work, you can still keep on teleporting.
Error at line "player.Character.Torso.CFrame" expected CFrame, given Vector3.new("") value.
ClassHolder = script.Parent ct = ClassHolder.CounterTerrorists t = ClassHolder.Terrorists ctspawn = game.Workspace.ctspawn --spawnpoint tspawn = game.Workspace.tspawn --spawnpoint Spectators = game.Workspace.Spectators player = game.Players.LocalPlayer Teamjoined = false ct.MouseButton1Down:connect(function() if Teamjoined == false then player.TeamColor = BrickColor.new('Really blue') player.Character.Torso.CFrame = Vector3.new(ctspawn.Position.X,ctspawn.Position.Y + ctspawn.Size.Y / 2 + 7,ctspawn.Position.Z)--This line Error CFrame expected player:LoadCharacter() ClassHolder.Visible = false Teamjoined = true elseif Teamjoined == true then print('You already joined a team') end end) t.MouseButton1Down:connect(function(t) if Teamjoined == false then player.TeamColor = BrickColor.new('Really red') player.Character.Torso.CFrame = Vector3.new(tspawn.Position.X,tspawn.Position.Y + tspawn.Size.Y / 2 + 7,tspawn.Position.Z)--This line Error CFrame expected player:LoadCharacter() ClassHolder.Visible = false Teamjoined = true elseif Teamjoined == true then print('You already joined a team') end end)
You attempted to put a Vector3 instead of a CFrame, but instead you should give a CFrame with a Vector3, like this:
player.Character.Torso.CFrame = CFrame.new(Vector3.new(ctspawn.Position.X,ctspawn.Position.Y + ctspawn.Size.Y / 2 + 7,ctspawn.Position.Z))
I hope this helped. ;)
Problem:
You can't teleport a player
Solution:
There is a method for a Character in Roblox called MoveTo, this is used when moving/teleporting a character.
player.Character:MoveTo(Vector3.new(teleport location))
Hope this helped , jmanrock123