RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Q key for dribbling the ball Starter Gui"
-- local script in StarterGui local UserInputService = game:GetService("UserInputService") local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local ball = game.Workspace.Ball local function dribble(input, gameProcessedEvent) if input.KeyCode == Enum.KeyCode.Q and not gameProcessedEvent then local distance = (character.HumanoidRootPart.Position - ball.Position).magnitude if distance <= 10 then local dribbleForce = Instance.new("BodyVelocity") dribbleForce.MaxForce = Vector3.new(1000, 1000, 1000) dribbleForce.P = 2000 dribbleForce.Parent = ball dribbleForce.Velocity = character.HumanoidRootPart.CFrame.lookVector * 10 wait(0.5) dribbleForce:Destroy() end end end UserInputService.InputBegan:Connect(dribble)