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

how would i make a sign that changes to green when a specific person joins?

i'm not sure how i would make a sign that turns green when the persons name that's on the sign is in the game and turn back to the original color if they leave

i don't really have an example i cant really find anything that could be useful i'm sorry for no example

2 answers

✓ Accepted answer

This should work: (Put this script inside the sign)

local sign = script.Parent -- Assuming it's just a brick.
game.Players.PlayerAdded:Connect(function(player)
	if player.Name == "personsnamecomeshere" then
		sign.Color = Color3.fromRGB(255,0,0)
	end
end)
game.Players.PlayerRemoving:Connect(function(player)
	if player.Name == "personsnamecomeshere" then
		sign.Color = Color3.fromRGB(0,0,0)
	end
end)

Btw, the three numbers determines the color. So 255,0,0 is really red and 0,0,0 is really black. The color is your choice! I hope it works for you. Edit: the numbers for green are something about 77, 147, 56.

Well I'm not going to give you the exact code because that would be what we call "spoonfeeding" but I will show you the concepts you need to understand in order to create it

We will start with the "sign", i assume the sign has a property where it displays color

How to change properties

Now about the "when a specific person joins" there are two parts to this, firstly, we need to detect when a person joins, this is called an event. An event allows you to make certain code happen whenever the event occurs

Events

The certain event when a player joins is called PlayerAdded

And finally, the "specific person" part, so far, if you learned events and playeradded and all that, you now have the player. The player has a property, which is it's Name. To check if it's name is a certain name, we would use an if statement to check if the name (which is a string) matches the name of the specific person

Alternatively, you can also check if the person's UserId is equal to another UserId just in case their name is changed, and UserId is a property of player and is a number that you can find on your profile page url

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