Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

why does this always equal false?[unsolved]

if mouse.Target.BrickColor == BrickColor.new("New Yeller") and player.leaderstats.level.Value >= 1 then
					_G.q = false
					thing()
				elseif mouse.Target.BrickColor == BrickColor.new("Deep orange") and player.leaderstats.level.Value > 5 then
					_G.q = true
				elseif mouse.Target.BrickColor == BrickColor.new("Deep orange") and player.leaderstats.level.Value >= 5 then
					_G.q = false
					thing()
				elseif mouse.Target.BrickColor == BrickColor.new("Lime green") and player.leaderstats.level.Value > 10 then
					_G.q = true
				elseif mouse.Target.BrickColor == BrickColor.new("Lime green") and player.leaderstats.level.Value >= 10 then
					_G.q = false
					thing()
end

where mouse = game.Players.LocalPlayer:GetMouse() and thing() is a function that works i did a print(_G.q), and it printed false. always printed false, no matter what, what it's supposed to do is if the mouses targets brickcolor is orange, and my level is less then 5, it's supposed to make _G.q true, but it doesn't. any help?

1 answer

Your problem is in the way the script is ordered. I see that the only reason "true" would return is if the third argument was true, but the problem is that if the value is bigger than 10 then it is definitely bigger than 5 meaning your first argument will return false right away instead of moving on to any other arguments. Try ordering your script like this:

if mouse.Target.BrickColor == BrickColor.new("New Yeller") and player.leaderstats.level.Value >= 1 then
                    _G.q = false
                elseif mouse.Target.BrickColor == BrickColor.new("Deep orange") and player.leaderstats.level.Value > 10 then
                    _G.q = true
                    thing()
                elseif mouse.Target.BrickColor == BrickColor.new("Deep orange") and player.leaderstats.level.Value > 5 then
                    _G.q = true
                elseif mouse.Target.BrickColor == BrickColor.new("Deep orange") and player.leaderstats.level.Value >= 5 then
                    _G.q = false
                    thing()
                elseif mouse.Target.BrickColor == BrickColor.new("Lime green") and player.leaderstats.level.Value >= 10 then
                    _G.q = false
                    thing()
end

Now the script will always check if the value is greater than 10, before moving on to seeing if its bigger than 5. Hope this helped, feel free to ask any questions.

2 comments

0

hmm, it still only printed false

0

and i meant that if it is less then 5 or ten, not greater than if the player does not have at least level 10 for the lime green, then _G.q = true is what im going for

This discussion is preserved as it was. New answers, comments, and votes are closed.