I am trying to make a system where if the player has a specific item in their file(a file added to the player) an Gui image label background transparency is changed to tell the user if he has clamed the item or not. I tried it and nothing happened, was the same transparency as I left it.
here is my code:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local catscollected = player:WaitForChild("catsCollected")
if catscollected:FindFirstChild("sleeping cat") then
script.Parent.Transparency = 1
else
script.Parent.Transparency = 0.25
end
Your code is only running once, and that is when the player joins. If you want it to keep checking, put it in a loop:
while true do
if catscollected:FindFirstChild("sleeping cat") then
script.Parent.Transparency = 1
else
script.Parent.Transparency = 0.25
end
wait()
end
Note that this loop will hold the script, so anything after the loop won’t run. To fix that, I recommend you put this in its own script (if it isn’t already).