For some reason, this script doesn't work even though no errors are printed
script.Parent.Touched:Connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent)then
if game.ReplicatedStorage.Teams.Value == 0
hit.Parent.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(60.293, -88.617, -67))--Change to Position
game.ReplicatedStorage.Teams.Value = game.ReplicatedStorage.Teams.Value + 1
if game.ReplicatedStorage.Teams.Value == 1 then
hit.Parent.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(60.293, -90.617, 49.5))--Change to Position
game.ReplicatedStorage.Teams.Value = game.ReplicatedStorage.Teams.Value + 1
if game.ReplicatedStorage.Teams.Value == 2 then
hit.Parent.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(60.293, -88.617, -67))--Change to Position
game.ReplicatedStorage.Teams.Value = game.ReplicatedStorage.Teams.Value + 1
if game.ReplicatedStorage.Teams.Value == 3 then
hit.Parent.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(60.293, -90.617, 49.5))--Change to Position
game.ReplicatedStorage.Teams.Value = game.ReplicatedStorage.Teams.Value + 1
if game.ReplicatedStorage.Teams.Value == 4 then
hit.Parent.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(60.293, -88.617, -67))--Change to Position
game.ReplicatedStorage.Teams.Value = game.ReplicatedStorage.Teams.Value + 1
if game.ReplicatedStorage.Teams.Value == 5 then
hit.Parent.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(60.293, -90.617, 49.5))--Change to Position
game.ReplicatedStorage.Teams.Value = game.ReplicatedStorage.Teams.Value + 1
end
end
end)
Its meant to divide 6 players into 2 teams, with each of the 2 teleport spots being the team bases. If the number is odd then they are on the blue team but if it's even they are on the green team, every time someone touches the block the number goes up by one. If the script is sloppy I'm sorry, I'm new to scripting. It teleports the player when they touch the block. But for some reason, it isn't teleporting them.
Also if anyone has a more organized version of the script I would gladly use it.
So, If you know why this isn't working, could you help me, please?

1 comment
If it isn't outputting any errors, it may be because you have placed a Script where only a LocalScript would run or vice versa. Open the Script Analysis window and it'll complain about syntax errors (and other probable mistakes) without you having to run the place to find out.