Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local runService = game:GetService("RunService")
- local function findBall()
- for _, object in ipairs(workspace:GetChildren()) do
- if object.Name == "Football" and object:IsA("Part") then
- return object
- end
- end
- return nil
- end
- local function attractBall()
- local ball = findBall()
- if ball then
- local bodyPosition = Instance.new("BodyPosition")
- bodyPosition.MaxForce = Vector3.new(4000, 4000, 4000)
- bodyPosition.P = 10000
- bodyPosition.Position = character.HumanoidRootPart.Position
- bodyPosition.Parent = ball
- runService.Stepped:Connect(function()
- if ball and character and character:FindFirstChild("HumanoidRootPart") then
- bodyPosition.Position = character.HumanoidRootPart.Position
- end
- end)
- end
- end
- -- Automatically attract the ball continuously
- runService.Stepped:Connect(function()
- attractBall()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement