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

Can anyone fix this script?

Asked by 10 years ago

This script is supposed to clone the localscript in it into the player if they are on the zombies team.

game.Players:GetPlayers()
    if Player.TeamColor = "Medium Green"
        game.Workspace.Zombies.LocalScript:Clone()Player
    end

1 answer

Log in to vote
1
Answered by
Lacryma 548 Moderation Voter
10 years ago

Note: This will only run once.

while true do
    wait()
    for k,v in pairs(game.Players:GetPlayers()) do
          if v.TeamColor = BrickColor.new("Medium Green") then
                workspace.Zombies.LocalScript:Clone().Parent = v.PlayerGui
            end
    end
end

The way you were doing it was just wrong.

GetPlayers transforms all the players into a table that you will be able to iterate through.

TeamColor is a BrickColor.

When using clone you need to set the parent you want the clone to be located in.

Read more:

GetPlayers

BrickColor

0
wait, will it loop if I do whiletruedo? zachhg03 35 — 10y
0
Yep. Lacryma 548 — 10y
0
Okay, thanks. zachhg03 35 — 10y
Ad

Answer this question