This is my script, but It doesn’t really work and I might not done something good:
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local i = 1
local S = script.Parent
local function BrickTouch(Part)
local Parent = Part.Parent
if game.Players:GetPlayerFromCharacter(Parent) then
Player.Team = "Stage"..i + 1
end
end
S.Touched:connect(BrickTouch)
Are the SpawnLocation properties set correctly to spawn a user in a place based on their team?
Oh also, team must be an object, not a string.
Player.Team = game.Teams.Team
-- not
Player.Team = "Team"
Possible example:
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Teams = game:GetService("Teams")
local i = 1
local S = script.Parent
local function BrickTouch(Part)
local Parent = Part.Parent
if game.Players:GetPlayerFromCharacter(Parent) then
Player.Team = Teams["Stage"..i + 1]
end
end
S.Touched:Connect(BrickTouch)
Based on your script. I assume that you’re using the normal script. In which, the script doesn’t work because normal script don’t listen to LocalPlayer command
You might want to do something like this :
local i = 1
local function BrickTouch(Part)
if game.Players:GetPlayerFromCharacter(Part.Parent) then
local Player = Part.Parent
game.Players[Player.Name].Team = tostring("Stage"..i + 1)
end
end
Extra note : In case the part touch your accessories. It will error. You might want to develop this script
Every team spawns at their Team SpawnLocation, based on their TeamColor
By setting AllowTeamChangeOnTouch to true, it allows players to switch teams by simply touching the SpawnLocation.
Soo uhh, I just wan’t to say thanks for the help, but It doesn’t quite respawn me at the spawn location and I changed the color of the spawn location too, but still doesn’t work.