✓ Accepted answer
This is a simple task to do using the event Seated then setting the sit value of the humanoid to false, you can also use jump.
In your code you have use a loop which will connect a new function each time which is bad as we only need one function to do the job.
The StateChanged has two args the old state and the new state, you check the old state when we need its new state. Lastly you need to make the humanoid jump an Enum is just a data type and will not make the humanoid jump, only the humanoid can make itself jump.
Example:-
local humanoid= script.Parent.Humanoid
humanoid.StateChanged:Connect(function(state, newState)
print(newState)
if newState == Enum.HumanoidStateType.Seated then
humanoid.Jump = true
end
end)
As we have the seated event it would be best to use it because it will fire only when the humanoid sits which is what we need.
Example:-
local humanoid = script.Parent.Humanoid
humanoid.Seated:Connect(function(active, seatPart)
humanoid.Sit= false
end)
I hope this helps.
1 comment
Thanks for the help :-)