You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
Auto jump for PC, Console. Not just mobile players
What is the issue? Include screenshots / videos if possible!
Not really sure where to start when coding such a script.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Looked around and I don’t see anything for autojump for other platforms besides Mobile.
Try casting a ray from the HumanoidRootPart every RunService.RenderStepped and see if that works.
--LocalScript
local runService = game:GetService("RunService")
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local hrp = char:WaitForChild("HumanoidRootPart")
local params = RaycastParams.new()
params.FilterDescendantsInstances = char:GetDescendants()
params.IgnoreWater = true
params.RespectCanCollide = true
params.FilterType = Enum.RaycastFilterType.Exclude
local function autojump()
local origin = hrp.CFrame.Position
local direction = hrp.CFrame + (hrp.CFrame.LookVector * 1.5)
local result = workspace:Raycast(origin, direction, params)
if result then
hum:ChangeState(Enum.HumanoidStateType.Jumping)
end
end
runService:BindToRenderStep("Autojump", 2000, autojump)
Works great, but had to fix a issue and added a if player is in air check. I corrected the direction calculation by ensuring it properly adds a Vector3 to another Vector3 and added a condition to check if the character is on the ground before attempting to jump, to prevent unexpected behavior.
-- LocalScript
local runService = game:GetService("RunService")
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local hrp = char:WaitForChild("HumanoidRootPart")
local params = RaycastParams.new()
params.FilterDescendantsInstances = char:GetDescendants()
params.IgnoreWater = true
params.RespectCanCollide = true
params.FilterType = Enum.RaycastFilterType.Exclude
local function autojump()
local origin = hrp.Position
local direction = hrp.CFrame.LookVector * 1.5
local result = workspace:Raycast(origin, direction, params)
if result and hum.FloorMaterial ~= Enum.Material.Air then
hum:ChangeState(Enum.HumanoidStateType.Jumping)
end
end
runService:BindToRenderStep("Autojump", 2000, autojump)