Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I make a script like this, bc its not working for somer reason?

I tried to make it so ppl get teamed into a teamed after touching a part (not a spawn)

--put all the teams in a table .a table is a variable containing other variables 

teamBricks = {
        game.Workspace.RedPart
        game.Workspace.OrangePart,
        game.Workspace.BluePart
}


--when the player touches a team part, make the players team the team brick they stepped on.

function touchedPart(hit, teamPart)
        local player = game.Players:FindFirstChild(hit.Parent.Name)

        local team = game.Teams:FindFirstChild(teamPart.Name

       if(player and team)then
                player.Team = team
        end
end

--make a touch event for each brick
for i = 1, #teamBricks do
       teamBricks[i].Touched:Connect(function() touchedPart (TeamBricks[i]) end)
end

i got it from somebody but its not working please help ~Lowmeister

2 comments

0

Uh while you could use a script why not use roblox's built-in function in a "SpawnLocation" part?

0

Bc i only want to team the players into a team i dont want them to spawn there

1 answer

This isn't a complete answer, and it may not fix it, but I have a few suggestions.

One: On the fourth line, you didn't add a comma after 'RedPart'. Two: On the fifteenth line, you don't have a closing bracket, you only have an opening one.

That's it. This might not fix it all though, just saying.

This discussion is preserved as it was. New answers, comments, and votes are closed.