Hello , please tell me how to make the player constantly jumping and can not stop, I searched everywhere, but never found the answer to my question. I mean the player should jump ALWAYS WITHOUT STOPPING
local humanoid -- define humanoid here
humanoid:ChangeState(Enum.HumanoidStateType.Jumping) -- jumps
humanoid.StateChanged:Connect(function()
if humanoid:GetState() ~= Enum.HumanoidStateType.Jumping then
-- fires everytime the player stops jumping
humanoid:ChangeState(Enum.HumanoidStateType.Jumping) --jumps
end
end)
The mistake is that the Humanoid is not defined. It is what known as nil, which is nothing. I think the best way to do this is have everything in a function like so.
Script in ServerScriptService:
game.Players.PlayerAdded:Connect(function(Player)
local Character = Player.Character or Player.CharacterAdded:Wait()
local humanoid = Character:WaitForChild(“Humanoid”)
humanoid:ChangeState(Enum.HumanoidStateType.Jumping) -- jumps
humanoid.StateChanged:Connect(function()
if humanoid:GetState() ~= Enum.HumanoidStateType.Jumping then
-- fires everytime the player stops jumping
humanoid:ChangeState(Enum.HumanoidStateType.Jumping) --jumps
I tried it, but I didn’t jump without my input. And I want the player to jump without my input, that is, by himself. I’m sorry, maybe I’m not explaining it right or doing it wrong, but I’m downloading your scripts in serverscriptservice, but nothing is getting done
You have to define the humanoid. Assuming this is a LocalScript in the player’s Character (achieved via putting your script in StarterCharacterScripts), the humanoid can be defined like so:
local humanoid = script.Parent:WaitForChild("Humanoid")
Then you can test it out and see if it works or doesn’t.