Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

0
Uh while you could use a script why not use roblox's built-in function in a "SpawnLocation" part? VitroxVox 884 — 4y
0
Bc i only want to team the players into a team i dont want them to spawn there Lowmeister 11 — 4y

Closed as Non-Descriptive by maumaumaumaumaumua, ForeverBrown, BashGuy10, and hiimgoodpack

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 4 years ago

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.

Ad