RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"When a player presses X on their controller, their character will dive forward onto the ground."
-- local script local UserInputService = game:GetService("UserInputService") local Players = game:GetService("Players") local localPlayer = Players.LocalPlayer local character = localPlayer.Character or localPlayer.CharacterAdded:Wait() local function onInputBegan(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.ButtonX and not gameProcessedEvent then local humanoid = character:FindFirstChild("Humanoid") if humanoid then humanoid:ChangeState(Enum.HumanoidStateType.Physics) humanoid.PlatformStand = true local bodyVelocity = Instance.new("BodyVelocity") bodyVelocity.Parent = character.HumanoidRootPart bodyVelocity.Velocity = character.HumanoidRootPart.CFrame.LookVector * 50 wait(0.5) humanoid.PlatformStand = false bodyVelocity:Destroy() end end end UserInputService.InputBegan:Connect(onInputBegan)