The title says it. Can you make it using a TextButton? I don’t really know how to make that
4 Likes
Jump by Button.rbxl (42.9 KB)
I attached a script that should solve your problem. It has a text button that can be clicked or pressed to make the character jump. Here is the code of the Local Script inside the button:
-- Parameters
local WAIT_TIME = .5
-- Services
Player = game:GetService("Players")
local button = script.Parent
local canActivate = true
local function playerJump()
if canActivate then
canActivate = false
local localPlayer = Player.LocalPlayer
local character = localPlayer.Character
local Humanoid = character:WaitForChild("Humanoid")
local oldJumpPower = Humanoid.JumpPower
Humanoid.JumpPower = 100
Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
Humanoid.JumpPower = oldJumpPower
task.wait(WAIT_TIME)
canActivate = true
end
end
button.Activated:Connect(playerJump)
References:
4 Likes
When you start the game, the control module will be inside your player.PlayerScripts copy them and you will see the joystick image in the touch module, change that image.
2 Likes
Does
Humanoid.JumpPower = 100
and
Humanoid.JumpPower = oldJumpPower
mean that we need to change the JumpPower of the Player so the Character can jump, and then after that, we need to change the jump power to the old one again so we can jump normally after that?
You don’t need that code. If you want the button to jump a different amount than the default jump, it’s there.
1 Like