I was found a mobile buttons tutorial on youtube and decided to use it on my testing game. The script worked perfectly if not better when I tried it on one of my scripts. I decided to use it on another script and it worked fine, but something was missing. The other script that I turned into a mobile button is supposed to launch the player down and give you jump height for a short time. When testing it in game, it only launches you down. It doesn’t give you some jump height. I tried increasing the jump height to a big number to see if it was just me, and it still didn’t work.
here is the code. It goes in starter player scripts. Please tell me what’s wrong
local cas = game:GetService("ContextActionService")
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local function buttonPressFunction()
char.HumanoidRootPart.Velocity = char.HumanoidRootPart.CFrame.UpVector*-130
-- change to five times faster than default speed
local h = script.Parent:FindFirstChild("Humanoid")
local plr = game.Players.LocalPlayer
local humanoid = plr.Character:WaitForChild('Humanoid')
local currenstate = humanoid:GetState()
if currenstate == Enum.HumanoidStateType.Freefall then
h.JumpPower = 90
wait(1)
h.JumpPower = 60
end
end
local button = cas:BindAction("StompButton", buttonPressFunction, true, Enum.KeyCode.LeftControl)
cas:SetPosition("StompButton", UDim2.new(0.58, -80, 0.15, 80))