Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Gui to Lua
- -- Version: 3.6
- -- Instances:
- local TouchGui = Instance.new("ScreenGui")
- local TouchControlFrame = Instance.new("Frame")
- local JumpButton = Instance.new("ImageButton")
- -- Properties:
- TouchGui.Name = "TouchGui"
- TouchGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- TouchGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- TouchGui.ResetOnSpawn = false
- TouchControlFrame.Name = "TouchControlFrame"
- TouchControlFrame.Parent = TouchGui
- TouchControlFrame.BackgroundTransparency = 1.000
- TouchControlFrame.BorderColor3 = Color3.fromRGB(27, 42, 53)
- TouchControlFrame.Size = UDim2.new(1, 0, 1, 0)
- JumpButton.Name = "JumpButton"
- JumpButton.Parent = TouchControlFrame
- JumpButton.BackgroundTransparency = 1.000
- JumpButton.BorderColor3 = Color3.fromRGB(27, 42, 53)
- JumpButton.Position = UDim2.new(0.900000036, -95, 1.01530623, -90)
- JumpButton.Size = UDim2.new(0, 60, 0, 60)
- JumpButton.Image = "rbxassetid://17778284226"
- JumpButton.ImageTransparency = 0.500
- -- Scripts:
- local function YJFYK_fake_script() -- JumpButton.LocalScript
- local script = Instance.new('LocalScript', JumpButton)
- local button = script.Parent -- Reference to the ImageButton
- local infJumpEnabled = false -- State of infinite jump
- local userInputService = game:GetService("UserInputService")
- local player = game.Players.LocalPlayer
- -- Function to update the button's image
- local function updateButtonImage()
- if infJumpEnabled then
- button.Image = "rbxassetid://17755361063" -- ON image asset
- else
- button.Image = "rbxassetid://17778284226" -- OFF image asset
- end
- end
- -- Toggle infinite jump state
- local function toggleInfJump()
- infJumpEnabled = not infJumpEnabled
- updateButtonImage()
- end
- -- Infinite jump function
- local function enableInfiniteJump()
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoid = character:FindFirstChild("Humanoid")
- if humanoid then
- humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
- end
- end
- -- Listen to the mobile jump button
- local function setupMobileJumpButton()
- local touchGui = player:WaitForChild("PlayerGui"):WaitForChild("TouchGui")
- local jumpButton = touchGui:WaitForChild("TouchControlFrame"):WaitForChild("JumpButton")
- jumpButton.MouseButton1Click:Connect(function()
- if infJumpEnabled then
- enableInfiniteJump()
- end
- end)
- end
- -- Listen to spacebar or general inputs
- local function onInputBegan(input, isProcessed)
- if infJumpEnabled and not isProcessed then
- if input.KeyCode == Enum.KeyCode.Space then
- enableInfiniteJump()
- end
- end
- end
- -- Initialize
- button.MouseButton1Click:Connect(toggleInfJump)
- userInputService.InputBegan:Connect(onInputBegan)
- -- Set initial button image
- updateButtonImage()
- -- Setup the mobile jump button
- if userInputService.TouchEnabled then
- setupMobileJumpButton()
- end
- end
- coroutine.wrap(YJFYK_fake_script)()
- local function HPMNU_fake_script() -- JumpButton.MobileOnly
- local script = Instance.new('LocalScript', JumpButton)
- --this script is gonna make his parent visible only for mobile users
- script.Parent.Visible = false -- makes his parent invisible for pc players
- uis = game:GetService("UserInputService") -- this line gets the service
- ismobile = uis.TouchEnabled -- this line checks if the user is on mobile
- script.Parent.Visible = ismobile -- this line makes the script's parent visible on mobile user screen
- end
- coroutine.wrap(HPMNU_fake_script)()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement