Editors note: I solved it, here is the solution for anyone else who comes across this and needs a simular script:

function onTouched(hit)
	for i,v in pairs(game.Players:GetPlayers()) do

	if hit.Parent.Humanoid ~= nil then
		if v.TeamColor == BrickColor.new("Really blue") then
			hit.Parent:SetPrimaryPartCFrame(CFrame.new(Vector3.new(156.9, 65.1, 24.5)))
			
			elseif v.TeamColor == BrickColor.new("Really red") then
			hit.Parent:SetPrimaryPartCFrame(CFrame.new(Vector3.new(-129.5, 65.1, 24.5)))
	end
	end
	end
	end
script.Parent.Touched:Connect(onTouched)

I usually turn to script helper as a last resort, but this is just rediculous, I have spent to much time on one script, and I need to move on.

The idea of the script is when they touch the pad, it sends them back to their teams, based on which team they are on

The script is a script<Part<Workspace if anyone wants to know whwere it came from, here is the code:

for i,v in pairs(game.Players:GetPlayers()) do
	if v:IsA("Player") then
local TeamColorRed = v.Teams.Red
local TeamColorBlue = v.Teams.Blue

function onTouched(part)
	if part.Parent.Humanoid ~= nil then
		if v.Teams == TeamColorRed then
			part.Parent:MoveTo(script.Parent.Parent.SpawnLocation1.Position)
			
		elseif v.Teams == TeamColorBlue then
			part.Parent:MoveTo(script.Parent.Parent.SpawnLocation.Position)
	end
	end
	end
	end
	end
script.Parent.Touched:Connect(onTouched)

3 comments

0

line 2 is useless because GetPlayers returns only player objects, MoveTo works on the humanoid, I recommend using SetPrimaryPartCFrame.

0

Now it says this in output - Attempt to connect failed: Passed value is not a function

0

Honestly did not help, so I put more hours into it... I needed the full answer because it was getting late and now its 4:09 A.M.