i want to make a ui that tracks how many collectibles the player has i have a leaderstat that tracks that but i want a ui to do it
it would bassicly have a greyed out image of the collectible and when you get the collectible it would make it the normal image
so bassicly i dont know how to code but it would be somehting like this
if game.player.Keys.Value = 1 then
game.startergui.collectibles.key.backroundcolor = 0,0,0
btw the leaderstat is called Keys
the screengui is called collectibles and the imagelabel is called key
i would have this script for each different key
local Player = game:GetService("Players").LocalPlayer
local Keys = Player:WaitForChild("leaderstats"):WaitForChild("Keys")
local function Reload()
if Keys.Value == 1 then
Player.PlayerGui:WaitForChild("Collectibles"):WaitForChild("Key").BackroundColor3 = Color3.fromRGB(0, 0, 0)
end
end
Keys:GetPropertyChangedSignal("Value"):Connect(Reload)
Reload()
this will work for you hopefully, assuming you have leaderstats set up correctly
local script inside StarterCharacterScripts should work
local player = game.Players.LocalPlayer
local Keys = player:WaitForChild("Keys")
local function Change()
if Keys.Value == 2 then -- change 2 to the number of keys you want it to change the colour for
player.PlayerGui:WaitForChild("Collectibles"):WaitForChild("Key").BackgroundColor = Color3.fromRGB(0,0,0) -- click on the numbers in the script and it will let you change the colour via a palette
end
end
Keys:GetPropertyChangedSignal("Value"):Connect(Change)
Change()
game.Players.PlayerAdded:Connect(function(Player)
local leaderstats = Player:WaitForChild("leaderstats")
local keys = leaderstats:WaitForChild("Keys")
keys.Changed:Connect(function()
if keys.Value == 2 then -- change 2 to the number of keys you want to change the colour at
-- change colour
end)
end)
what is the name of the gui you’re trying to change the colour of?
once you tell me i’ll script the part that changes the colour i just dont know what is supposed to change colour
sry i was eating lunch but the name of the ui’s i want to change are the keys
so there would be a different script for key1 2 and 3 and they would have different values
no so bassicly they all start black and once you collect the first key then the first one will change color i can do the colors you dont have to but ye bassicly each one changes color when you collect a collectible so the first one when you get the first collectble second when you get the second collectible etc