So I have this script that is supposed to change a decal depending on the tooltip, but it does not work, any help? here is the script
while true do
if script.Parent.ToolTip >= 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 script.Parent.ToolTip == 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")
end
end
First, a tooltip is a string and not a number, hence the operator script.Parent.ToolTip >= 1 would either always be true or always be false (I haven’t tested this yet)
This is easily fixed by wrapping script.Parent.ToolTip with tonumber(script.Parent.ToolTip)
The second problem is the logic of the if-statements
The first statement if script.Parent.ToolTip >= 1 then would return ‘true’ when the tooltip says 1 or a bigger number than 1, ‘false’ if it’s less than 1.
The second statement elseif script.Parent.ToolTip == 2 then would return ‘true’ should the tooltip be less than 1 and be 2.
And since 1 is not greater than 2, the second statement would not be true since the number would never be 2
So I’m assuming that the tooltip will never contain characters and only numbers.
while true do
if tonumber(script.Parent.ToolTip) == 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 tonumber(script.Parent.ToolTip) == 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")
end
end