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.
01 | ClassHolder = script.Parent |
02 | ct = ClassHolder.CounterTerrorists |
03 | t = ClassHolder.Terrorists |
04 | ctspawn = game.Workspace.ctspawn --spawnpoint |
05 | tspawn = game.Workspace.tspawn --spawnpoint |
06 | Spectators = game.Workspace.Spectators |
07 | player = game.Players.LocalPlayer |
08 |
09 | Teamjoined = false |
10 |
11 | ct.MouseButton 1 Down:connect( function () |
12 | if Teamjoined = = false then |
13 | player.TeamColor = BrickColor.new( 'Really blue' ) |
14 | player.Character.Torso.CFrame = Vector 3. new(ctspawn.Position.X,ctspawn.Position.Y + ctspawn.Size.Y / 2 + 7 ,ctspawn.Position.Z) --This line Error CFrame expected |
15 | player:LoadCharacter() |
You attempted to put a Vector3 instead of a CFrame, but instead you should give a CFrame with a Vector3, like this:
1 | player.Character.Torso.CFrame = CFrame.new(Vector 3. 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.
1 | player.Character:MoveTo(Vector 3. new(teleport location)) |
Hope this helped , jmanrock123