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

Can anyone fix this script?

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

✓ Accepted answer

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

3 comments

0

wait, will it loop if I do whiletruedo?

0

Yep.

0

Okay, thanks.

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