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

How to make a part turn into a different color when you have a badge?

I want to make it so like when you got a badge a part turns into a different color ex, green

2 comments

0

i dont have a code for this but im just looking for a script.

0

This isn't request site but I guess,

1 answer

Well, you can make it so that when the player picks up the badge he also gets a BoolValue with the name X and the script checks if he has the BoolValue if he does the Part turns green.

This is a LocalScript in StarterGui

local player = game:GetService("Players").LocalPlayer

local part = game.Workspace.ModelPart

local playerStats = Instance.new("Folder")
playerStats.Name = "PlayerStats"
playerStats.Parent = player

local bo = Instance.new("BoolValue") -- I created a folder where my BoolValue goes if I have the badge 
bo.Name = "Bool"						
bo.Parent = playerStats

while wait(2) do -- I created a loop to constantly check if you have the BoolValue

local boolisinPS = player:WaitForChild("PlayerStats")

	local bool = boolisinPS:FindFirstChild("Bool") -- I looked in the PlayerStats folder to see if it has BoolValue, here in this case the name of my BoolValue is "Bool" so it will look for that name 

	if bool then -- If BoolValue is then 
		
		part.BrickColor = BrickColor.Green() -- Changes the Color Part 
	end
end

Now the script that gives the player the BoolValue when he gets the Badge is up to you, Good luck!

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