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

How do I make this brick change color according to a player's team?

button = script.Parent
IsRaid = game.Workspace.IsRaid

function capture(plr)
	IsRaid.Value = true
	if plr.TeamColor == "Bright blue" then
		button.BrickColor = BrickColor.new("Bright blue")
	elseif plr.TeamColor == "Bright red" then
		button.BrickColor = BrickColor.new("Bright red")
	end
end

script.Parent.ClickDetector.MouseClick:connect(capture)

I am using this script as a raid terminal and I want this brick to change color and match the teamcolor of the player who clicked it. I was told that if you put something in the parentheses, it is a name for the player who clicked in this situation.

Do I have to word it a different way or change the way I write it?

1 answer

✓ Accepted answer

You have to do:

if plr.TeamColor == BrickColor.new("Bright blue") then

That way it will know what "Bright blue" is.

Hope this helped.

4 comments

0

Oh okay I will try that. I thought I remembered seeing something like that I just needed to find out the specfics.

0

Cool. It has worked for me in similar situations. Tell me if you need other help

0

Alright that worked great, the button works now, now for the capture process. I probably will need a lot of help but I will post them in separate questions.

0

Haha that's fun part right glad to help. If you want you can accept the answer(Translation: we both get better rep if you do. :))

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