Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Generated From Chat GPT-4
- -- Variables
- local plr = game.Players.LocalPlayer
- local uis = game:GetService("UserInputService")
- local rs = game:GetService("RunService")
- local footing = false
- local hasBall = false
- local label
- for i,v in pairs(plr.PlayerGui:GetDescendants()) do
- if v:IsA("TextLabel") and v.Text == "75" then
- label = v
- end
- end
- -- Functions
- function getGoal()
- local dist, goal = 9e9
- for i,v in pairs(workspace:GetDescendants()) do
- if v.Name == "Lol" or v.Name == "Goal" then
- local mag = (plr.Character.Torso.Position - v.Position).Magnitude
- if dist > mag then
- dist = mag; goal = v;
- end
- end
- end
- return goal
- end
- function getVector(goal)
- local dist = (plr.Character.Torso.Position - goal.Position).Magnitude
- return goal.Position + Vector3.new(0, 45 + (dist / 10)) - plr.Character.Humanoid.MoveDirection
- end
- function shootBall(vector)
- if hasBall then
- local event = plr.Character.Basketball.shoot_event
- local unit = (vector - plr.Character.Head.Position).Unit
- local spawnPos = plr.Character.PrimaryPart.Position + unit * 3.8
- if spawnPos.Y - plr.Character.PrimaryPart.Position.Y < 4 then
- spawnPos = plr.Character.PrimaryPart.Position + unit * 4
- end
- event:FireServer(
- vector,
- spawnPos,
- "\240\159\148\165\240\159\148\165"
- )
- end
- end
- function handleJumped()
- task.wait(0.225)
- shootBall(getVector(getGoal()))
- end
- function handleRender()
- local goal = getGoal()
- local dist = (plr.Character.Torso.Position - goal.Position).Magnitude
- if math.floor(dist) == 57 then
- footing = true
- else
- footing = false
- end
- if plr.Character and plr.Character:FindFirstChild("Basketball") then
- hasBall = true
- else
- hasBall = false
- end
- if hasBall then
- if footing then
- label.TextColor3 = Color3.fromRGB(0, 255, 0)
- else
- label.TextColor3 = Color3.fromRGB(255, 0, 0)
- end
- else
- label.TextColor3 = Color3.fromRGB(157, 157, 157)
- end
- end
- -- Connections
- plr.Character.Humanoid.Jumping:Connect(handleJumped)
- rs.Stepped:Connect(handleRender)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement