Any way to fix my money logic?

So I have this script that changes the money decal to the type of bill it most commonly corrilates with, but its not working, any help?

script.Parent.Equipped:Connect(function()

if script.Parent.MoneyValue.Value == 1 or 3<4 or 6<9 then

script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=7994761"

script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=7994777"

elseif script.Parent.MoneyValue.Value == 2 then

script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=12424991"

script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=12425000"

elseif script.Parent.MoneyValue.Value == 5 then

script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=7994783"

script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=7994786"

elseif script.Parent.MoneyValue.Value == 10<19 then

script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=85365754"

script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=85366004"

elseif script.Parent.MoneyValue.Value == 20<49 then

script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=85366394"

script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=85366498"

elseif script.Parent.MoneyValue.Value == 50<99 then

script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=12424991"

script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=12425000"

elseif script.Parent.MoneyValue.Value <= 100 then

script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=12424991"

script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=12425000"

end

end)

Its not the image, its the math logic.

That’s not how any of this works.

You have to reuse the directory to do the logic (It’s a little hard to explain). Also you should just define it in a variable instead of reusing all that code. This is how it should look like for one of them. (I’m not going to do it for all of them)

local moneyValue = script.Parent.MoneyValue

if moneyValue.Value == 20 and moneyValue.Value < 49 then

end

So this will pick up any number between 20 and 49?

No that is not the right way. This would give you a number between 20 and 49 inclusive.

local moneyValue = script.Parent.MoneyValue

if moneyValue.Value >= 20 and moneyValue.Value <= 49 then 

end

Alright, I will test this out right now.

It did not work? Any suggestions?

Post the entire code. I assume it’s causing an error because you haven’t fixed the formatting of your other if-statements.

script.Parent.Equipped:Connect(function()

if script.Parent.MoneyValue.Value == 1 or 3<4 or 6<9 then

script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=7994761"

script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=7994777"

elseif script.Parent.MoneyValue.Value == 2 then

script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=12424991"

script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=12425000"

elseif script.Parent.MoneyValue.Value == 5 then

script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=7994783"

script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=7994786"

elseif script.Parent.MoneyValue.Value == 10<19 then

script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=85365754"

script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=85366004"

elseif script.Parent.MoneyValue.Value >= 20 and script.Parent.MoneyValue.Value <= 49 then

script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=85366394"

script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=85366498"

elseif script.Parent.MoneyValue.Value == 50<99 then

script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=12424991"

script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=12425000"

elseif script.Parent.MoneyValue.Value <= 100 then

script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=12424991"

script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=12425000"

end

end)

Sigh… your other if-statements are still wrong. I have no clue what you’re trying to accomplish by doing
3<4 or 6<9 either, so I removed them from the code.

I can’t fix the formatting since I’m typing it on here, but please format it correctly for your own sake.

local moneyValue = script.Parent.MoneyValue

script.Parent.Equipped:Connect(function()
if moneyValue.Value == 1 then
  script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=7994761"
  script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=7994777"
elseif moneyValue.Value == 2 then
  script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=12424991"
  script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=12425000"
elseif moneyValue.Value == 5 then
  script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=7994783"
  script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=7994786"
elseif moneyValue.Value >= 10 or moneyValue.Value <= 19 then
  script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=85365754"
  script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=85366004"
elseif moneyValue.Value >= 20 and moneyValue.Value <= 49 then
  script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=85366394"
  script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=85366498"
elseif moneyValue.Value >= 50 and moneyValue.Value <= 99 then
  script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=12424991"
  script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=12425000"
elseif moneyValue.Value <= 100 then
  script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=12424991"
  script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=12425000"
end

What about for numbers like 3, I would like that to be a 1, but it comes out to a 10? I have no idea why.

It’s because it looks at the first few if-statements and says: moneyValue is not 1, or 2, or 5 and it fits the value of being <=19 so that’s why it goes to 10. I didn’t realize you had so many logic problems.

To fix this you could just remove all the if-statements checking if it’s a specific value like 1, 3, 5 and just make it so if the value is < 10 then you would make it the same image as a 1. Or if you want it to be specific so only a 1 and a 3 get the texture of a 1 then it would be:

if moneyValue.Value == 1 or money.Value == 3 then

It is not clear on what functionality you are looking for. Modify it to what you want it to do.

Yeah, I am not very good when it comes to logic like that.

Also, 19 gives you a 100 dollar bill.

It’s a little hard to tell on what functionality you want, so I’m just going to guess. It’s always going to make the 19 dollar bill a 100 because you put it to <= 100 which all numbers under 100 apply.

I can’t test this so I’m not really sure how this is going to work but this should make it so the image is now set to the closest one possible.

local moneyValue = script.Parent.MoneyValue

script.Parent.Equipped:Connect(function()
if moneyValue.Value == 1 then
  script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=7994761"
  script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=7994777"
elseif moneyValue.Value < 4 and moneyValue.Value ~= 1 then
  script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=12424991"
  script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=12425000"
elseif moneyValue.Value >= 4 and money.Value < 8 then
  script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=7994783"
  script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=7994786"
elseif moneyValue.Value >= 8 and moneyValue.Value < 15 then
  script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=85365754"
  script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=85366004"
elseif moneyValue.Value >= 15 and moneyValue.Value < 35 then
  script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=85366394"
  script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=85366498"
elseif moneyValue.Value >= 35 and moneyValue.Value < 75 then
  script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=12424991"
  script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=12425000"
elseif moneyValue.Value >= 100 then
  script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=12424991"
  script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=12425000"
end

I was actually able to fix this. Thank you.