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

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

Asked by 3 years ago

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

0
i dont have a code for this but im just looking for a script. PopcornGian101 0 — 3y
0
This isn't request site but I guess, CraftyAlphaMan 11 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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!

Ad

Answer this question