im trying to make a set speed box and compare the text inside it with another text that holds my speed but it doesnt work why? local script:
if not script.Parent.Text > script.Parent.Parent.jump.Text then game.Players.LocalPlayer.Character.Humanoid.JumpPower = script.Parent.Text end
error: 17:18:54.828 - Players.world_kiIIer.PlayerGui.ScreenGui.speed.speed:1: attempt to compare string with boolean
17:18:54.828 - Stack Begin
17:18:54.829 - Script 'Players.world_kiIIer.PlayerGui.ScreenGui.speed.speed', Line 1
17:18:54.829 - Stack End idk what that means
I think that in this text box you want to enter an Number
, but the Text
property holds a String
. To transform the String
into a Number
you need the tonumber()
function. This way, you can compare these two.
You can also ensure your safety in the code by instead of writing not script.Parent.Text > script.Parent.Parent.jump.Text
, you would write not (script.Parent.Text > script.Parent.Parent.jump.Text)
, so it looks at the result, not at one of the numbers.