I tried basically to "nest" it by putting one if statement under another and I even tried the "and" operator, this is what I have so far:
--drgigabyte local broomOne = script.Parent.Parent local messOne = game.Workspace.floormesses.mess1 local messTwo = game.Workspace.floormesses.mess2 local messThree = game.Workspace.floormesses.mess3 local cashOne = game.Players.LocalPlayer.leaderstats.Money script.Parent.Touched:connect(function(hit) if hit.Parent.Name == 'floormesses' then wait(.2) hit.Decal.Transparency = 1 cashOne.Value = cashOne.Value + 10 wait(.1) script.Disabled = true wait(6) script.Disabled = false end end)
I'd like to have the second if be something like "If hit.Decal.Transparency > 1 then"
You should just be able to use the and
operator to check both in the same line (nested if statements would work too). It is also important to check if hit has something called Decal inside before checking the transparency of the decal to avoid errors.
if hit.Parent.Name == 'floormesses' and hit:FindFirstChild("Decal") and hit.Decal.Transparency > 1 then
However, since the maximum transparency is 1 (1 is completely transparent), you might want to rethink this check. If you want to check if the decal is not transparent, it would be Transparency < 1
.
If I understand what you're trying to do correctly, then wouldn't it be something like this?
--drgigabyte local broomOne = script.Parent.Parent local messOne = game.Workspace.floormesses.mess1 local messTwo = game.Workspace.floormesses.mess2 local messThree = game.Workspace.floormesses.mess3 local cashOne = game.Players.LocalPlayer.leaderstats.Money script.Parent.Touched:connect(function(hit) if hit.Parent.Name == 'floormesses' then -- the first if statement if hit.Decal.Transparency > 1 then -- the second if statement wait(.2) hit.Decal.Transparency = 1 cashOne.Value = cashOne.Value + 10 wait(.1) script.Disabled = true wait(6) script.Disabled = false end -- end to the2nd one end -- end to the 1st one end)