Hello everyone, now my script has no errors in the output but I did use the print method.
After I have found out where the script wasn't working I didn't know how to fix it. Therefore, I request assistance from anyone who knows how to fix my current mistake.
A few notes before you continue:
Note 1: This is a Server Script Note 2: This script is placed in ServerScriptService
And now here's the script;
local teamForFirstGuy local BlueSpawn = game.Workspace:WaitForChild('BlueTower').BlueSpawn local RedSpawn = game.Workspace:WaitForChild('RedTower').RedSpawn game.Players.PlayerAdded:connect(function(plr) print('Attempt 1') local Stats = Instance.new('Model') Stats.Name = 'PlrStats' Stats.Parent = plr print('attempt 2') local Team = Instance.new("StringValue") Team.Name = "Team" if teamForFirstGuy then Team.Value = teamForFirstGuy == "Blue" and "Red" or "Blue" else Team.Value = math.random() < .5 and "Blue" or "Red" teamForFirstGuy = Team.Value print('attempt 3') end Team.Parent = Stats print('attempt 4') plr.CharacterAdded:Connect(function(char) print('attempt 5') if Team.Value == 'Red' then print('attempt 6') char.HumanoidRootPart.CFrame = BlueSpawn.CFrame print('attempt7') else print('attempt 8') char.HumanoidRootPart.CFrame = RedSpawn.CFrame print('attempt 9') end end) end)
Now here are some notes about the prints;
Prints: the prints only print up to Attempt 6 Note: The problem is probably where the
char.HumanoidRootPart.CFrame = BlueSpawn.CFrame
starts.
Thank you for any support or feedback.
This has been edited so now it doesn't print attempt 6 and 7 and I still don't get teleported
At lines 26 and 30, you're trying to make a Vector3 with another Vector3 as input.
Vector3.new(BlueSpawn.Position))
is wrong. You can just use BlueSpawn.Position
directly to make your CFrame.