RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Q key for dribbling the ball"
-- local script local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local dribbling = false local function dribble() if dribbling then dribbling = false else dribbling = true local ball = game.Workspace.Ball local distance = (ball.Position - character.HumanoidRootPart.Position).Magnitude if distance <= 10 then ball:SetNetworkOwner(player) ball.Velocity = character.HumanoidRootPart.CFrame.lookVector * 50 wait(0.5) ball:SetNetworkOwner(nil) end dribbling = false end end local function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.Q and not gameProcessedEvent then dribble() end end game:GetService("UserInputService").InputBegan:Connect(onKeyPress)