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

It gives me "attempt to compare number with boolean" error on the if s > 1 part..?

wait()
local WA = Instance.new("Animation")
local IA = Instance.new("Animation")
local JA = Instance.new("Animation")
IA.AnimationId = "rbxassetid://2864159998"
JA.AnimationId = "rbxassetid://2864429112"
WA.AnimationId= "rbxassetid://2864578077"

local humanoid = script.Parent.Humanoid


local IdleAnimation = humanoid:LoadAnimation(IA)
local JumpAnimation = humanoid:LoadAnimation(JA)
local WalkAnimation = humanoid:LoadAnimation(WA)

humanoid.Running:Connect(function(s)
	if s > 1 then
		IdleAnimation:Stop()
		WalkAnimation:Play()
	else
	
		IdleAnimation:Play()
		WalkAnimation:Stop()
		
	end
	
end)

humanoid.Jumping:Connect(function(s)
	if s > 1 then
		print("lol")
	end
end)

3 comments

0

line 30

0

The argument passed to your Jumpingcallback function is the boolean that determines if they're jumping. Not a number.

0

so what do i do??

1 answer

✓ Accepted answer

Well, the paramater on the Running and Jumping event is a boolean value, so it will either be false or true, and you obviously can't compare a boolean and a number. So I guess what you want to do is check if it's true. So that's waht you gotta do, and always keep on mind that paramaters are almost never numbers, they are all the time just a bool or an object as incapaz said.

Now this is waht you wanna do:

humanoid.Running:Connect(function(s)
    if s == true then
        IdleAnimation:Stop()
        WalkAnimation:Play()
    else

        IdleAnimation:Play()
        WalkAnimation:Stop()

    end

end)

humanoid.Jumping:Connect(function(s)
    if s == true then
        print("lol")
    end
end)

5 comments

0

thanksss

0

np!

0

that was mcandrobloxunited not me

0

oh, he removed his comment so i thought i was wrong xd so i edited the answer and said its you

0

sorry

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