How would I go about making a bicycle jump? I’ve tried the following, where I already have a VectorForce controlling the forward movement of the bike. However, I’m unsure if a VectorForce is appropriate for making it jump, and I can’t think of alternative ways. This is what I’ve got and I’ve basically hit a brick wall in my brain from here. Any help is appreciated, thanks.
local HoldingSpace = false
local Jumping = false
function JumpChanged()
while HoldingSpace do
if not Jumping then
Jumping = true
Force.Force = Vector3.new(Force.Force.X, 1000, Force.Force.Z) -- increase the Y force by 1000
repeat task.wait() until PlayerHasFinishedJumpAndIsBackOnTheGround -- dont know how to detect once the player is back on the ground
Jumping = false -- player is on the ground! let us jump again!
end
end
end
UserInputService.InputBegan:Connect(function(Key)
if Key.KeyCode == Enum.KeyCode.Space then
HoldingSpace = true
JumpChanged()
end
end)
UserInputService.InputEnded:Connect(function(Key)
if Key.KeyCode == Enum.KeyCode.Space then
HoldingSpace = false
end
end)
local UserInputService = game:GetService("UserInputService")
local HoldingSpace = false
local Jumping = false
local function isPlayerOnTheGround()
return false
end
local function JumpChanged()
while HoldingSpace do
if not Jumping then
Jumping = true
Force.Force = Vector3.new(Force.Force.X, 1000, Force.Force.Z)
repeat
task.wait(0.1)
until isPlayerOnTheGround()
Jumping = false
else
task.wait(0.1)
end
end
end
UserInputService.InputBegan:Connect(function(Key, Processed)
if not Processed and Key.KeyCode == Enum.KeyCode.Space then
HoldingSpace = true
JumpChanged()
end
end)
UserInputService.InputEnded:Connect(function(Key)
if Key.KeyCode == Enum.KeyCode.Space then
HoldingSpace = false
end
end)
The question I’m asking is how would I detect if the player is on the ground? I don’t understand, you just copy and pasted my original script and added a function?