Hi everyone,
I’m working on a Blue Lock–inspired soccer game and I’m trying to build a ball control system similar to what you’d see in Azure Latch or anime-style soccer games.
So far, I’ve created a basic weld system that works like this:
- When the player touches the ball, it welds to their HumanoidRootPart
- The ball moves with them while walking
- It uses a WeldConstraint and stops other players from picking it up
Here’s the script I used (If there’s anything I can do to make it function better please let me know):
local ball = workspace:WaitForChild("Ball")
local Players = game:GetService("Players")
ball.Touched:Connect(function(hit)
local character = hit:FindFirstAncestorWhichIsA("Model")
if not character then return end
local player = Players:GetPlayerFromCharacter(character)
if not player then return end
if character:FindFirstChild("HasBall") then return end
local hasBall = Instance.new("BoolValue")
hasBall.Name = "HasBall"
hasBall.Parent = character
local hrp = character:FindFirstChild("HumanoidRootPart")
if hrp then
ball.CFrame = hrp.CFrame * CFrame.new(0, 0, -2)
local weld = Instance.new("WeldConstraint")
weld.Part0 = ball
weld.Part1 = hrp
weld.Parent = ball
ball.Anchored = false
ball.CanCollide = false
print(player.Name .. " picked up the ball!")
end
end)
What I’d like help with:
- How can I make the ball move smoothly around the player, like a dribble circle?
- Should I switch from Welds to AlignPosition, CFrame, or something else for smoother movement?
- How would I later add a kick system with a power bar + directional shooting?
I’m not using free models — I’m learning Lua from AlvinBlox and doing everything myself. I just want to make sure I’m going about this the right way, and I’d love any advice on structure, animation syncing, or future expandability. I’d love to get better at writing clean and expandable code, so I appreciate any feedback — even if it’s small.
Thanks in advance!