hi, im making a script where a number's going down (already done that script) and this script is supposed to check what the number is, and change the parents of some models depending on how big the number is, but it isnt working, can anyone help me?
local RepStorage = game.ReplicatedStorage.BoxTypes
local Percent = script.Parent.Percentage
while true do
if Percent > 90 then
script.Parent:FindFirstChild("Danger").Parent = RepStorage
script.Parent:FindFirstChild("Open").Parent = RepStorage
script.Parent:FindFirstChild("Opening").Parent = RepStorage
script.Parent:FindFirstChild("Peeking").Parent = RepStorage
RepStorage.Closed.Parent = script.Parent
end
if Percent < 90 and Percent > 65 then
script.Parent:FindFirstChild("Danger").Parent = RepStorage
script.Parent:FindFirstChild("Open").Parent = RepStorage
script.Parent:FindFirstChild("Opening").Parent = RepStorage
script.Parent:FindFirstChild("Closed").Parent = RepStorage
RepStorage.Peeking.Parent = script.Parent
end
if Percent < 65 and Percent > 35 then
script.Parent:FindFirstChild("Danger").Parent = RepStorage
script.Parent:FindFirstChild("Open").Parent = RepStorage
script.Parent:FindFirstChild("Closed").Parent = RepStorage
script.Parent:FindFirstChild("Peeking").Parent = RepStorage
RepStorage.Opening.Parent = script.Parent
end
if Percent < 35 and Percent > 10 then
script.Parent:FindFirstChild("Danger").Parent = RepStorage
script.Parent:FindFirstChild("Opening").Parent = RepStorage
script.Parent:FindFirstChild("Closed").Parent = RepStorage
script.Parent:FindFirstChild("Peeking").Parent = RepStorage
RepStorage.Open.Parent = script.Parent
end
if Percent <= 10 then
script.Parent:FindFirstChild("Open").Parent = RepStorage
script.Parent:FindFirstChild("Opening").Parent = RepStorage
script.Parent:FindFirstChild("Closed").Parent = RepStorage
script.Parent:FindFirstChild("Peeking").Parent = RepStorage
RepStorage.Danger.Parent = script.Parent
end
end

7 comments
Judging by the code shown, I'm assuming that the "Percent" variable is a NumberValue object, right?
yes
you probably get error attempt to compare NumberValue with number, you need to compare values of same type, NumberValue is not same as number, however, you can type Percentage.Value which is a number, in other words:
replace Percentage with Percentage.Value on lines: 33, 26, 19, 12, 5
and use elseif
OMG I REALLY FORGOT .value, OMGGGGGG that makes me so angry, thanks for pointing that out though
ok still didnt work but im going to post the script at its current state