Advertisement
DiscordPastebins

modern jump button roblox pc & mobile (if jump power under 50 it will be still 50)

Jun 9th, 2024
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. -- Gui to Lua
  2. -- Version: 3.2
  3.  
  4. -- Instances:
  5.  
  6. local TouchGui = Instance.new("ScreenGui")
  7. local TouchControlFrame = Instance.new("Frame")
  8. local JumpButton = Instance.new("ImageButton")
  9.  
  10. --Properties:
  11.  
  12. TouchGui.Name = "TouchGui"
  13. TouchGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  14. TouchGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  15. TouchGui.ResetOnSpawn = false
  16.  
  17. TouchControlFrame.Name = "TouchControlFrame"
  18. TouchControlFrame.Parent = TouchGui
  19. TouchControlFrame.BackgroundTransparency = 1.000
  20. TouchControlFrame.Size = UDim2.new(1, 0, 1, 0)
  21.  
  22. JumpButton.Name = "JumpButton"
  23. JumpButton.Parent = TouchControlFrame
  24. JumpButton.BackgroundTransparency = 1.000
  25. JumpButton.Position = UDim2.new(1, -95, 1, -90)
  26. JumpButton.Size = UDim2.new(0, 70, 0, 70)
  27. JumpButton.Image = "rbxassetid://17778284226"
  28.  
  29. -- Scripts:
  30.  
  31. local function ZCZDVIY_fake_script() -- JumpButton.LocalScript
  32. local script = Instance.new('LocalScript', JumpButton)
  33.  
  34. local imageButton = script.Parent
  35.  
  36. local buttonHeld = false
  37.  
  38. local function makePlayerJump()
  39. local player = game.Players.LocalPlayer
  40.  
  41. if player and player.Character and player.Character:FindFirstChildOfClass("Humanoid") then
  42. local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
  43.  
  44. if humanoid:GetState() == Enum.HumanoidStateType.Running
  45. or humanoid:GetState() == Enum.HumanoidStateType.RunningNoPhysics
  46. or humanoid:GetState() == Enum.HumanoidStateType.Climbing
  47. or humanoid:GetState() == Enum.HumanoidStateType.Physics then
  48. local originalJumpPower = humanoid.JumpPower
  49.  
  50. if humanoid.JumpPower < 50 then
  51. humanoid.JumpPower = 50
  52. end
  53.  
  54. humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
  55.  
  56. wait(0.0001)
  57. humanoid.JumpPower = originalJumpPower
  58. else
  59. end
  60. else
  61. end
  62. end
  63.  
  64. local function onButtonDown()
  65. buttonHeld = true
  66. while buttonHeld do
  67. makePlayerJump()
  68. wait(0.0001)
  69. end
  70. end
  71.  
  72. local function onButtonUp()
  73. buttonHeld = false
  74. end
  75.  
  76. local function onMouseLeave()
  77. buttonHeld = false
  78. end
  79.  
  80. imageButton.MouseButton1Down:Connect(onButtonDown)
  81. imageButton.MouseButton1Up:Connect(onButtonUp)
  82. imageButton.MouseLeave:Connect(onMouseLeave)
  83.  
  84. end
  85. coroutine.wrap(ZCZDVIY_fake_script)()
  86. local function EKJKF_fake_script() -- JumpButton.LocalScript
  87. local script = Instance.new('LocalScript', JumpButton)
  88.  
  89. local imageButton = script.Parent
  90.  
  91. -- Define the image IDs (replace these with your own image asset IDs)
  92. local defaultImage = "rbxassetid://17778284226" -- Replace with the ID of the default image
  93. local holdImage = "rbxassetid://17755361063" -- Replace with the ID of the image when holding
  94.  
  95. -- Function to change the image when the button is held down
  96. local function onMouseButton1Down()
  97. imageButton.Image = holdImage
  98. end
  99.  
  100. -- Function to change the image when the button is released
  101. local function onMouseButton1Up()
  102. imageButton.Image = defaultImage
  103. end
  104.  
  105. -- Connect the functions to the appropriate events
  106. imageButton.MouseButton1Down:Connect(onMouseButton1Down)
  107. imageButton.MouseButton1Up:Connect(onMouseButton1Up)
  108.  
  109. -- Ensure the default image is set initially
  110. imageButton.Image = defaultImage
  111.  
  112. end
  113. coroutine.wrap(EKJKF_fake_script)()
  114.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement