How can i make a kicking system for a football game similar to super blox

The title is what I’m trying to achieve.

2 Likes

Hey! I think I just played Super Blox (to see what you’re talking about).

I assume you’d want to kick the soccer ball using a TextButton. When a player clicks the button, check the magnitude (distance) between the player’s HumanoidRootPart and the soccer ball like this (this is a local script that should go inside your button):

script.Parent.MouseButton1Click:Connect(function()
if (Player.Character.HumanoidRootPart.Position - Soccer_Ball.Position).Magnitude <= 5 then
--Rest of your code
end
end)

Then, you could apply a forward force to the soccer ball by multiplying it’s velocity property by how far you want it to go (honestly just change the xValue number to what ever you want you could also make it a negative if it’s going the wrong way)

script.Parent.MouseButton1Click:Connect(function()
if (Player.Character.HumanoidRootPart.Position - Soccer_Ball.Position).Magnitude <= 5 then
Soccer_Ball.Velocity = Vector3.new(50, 0, 0)
end
end)

There you go. Hopefully this works for you. I kinda wrote this on my phone so there might be some errors. If it doesn’t work I’ll be happy to try to fix it.

1 Like

Lol i made a game simillar to what you want I can uncopylock it for you if it something you like since i cba to finish it im working on something else atm (7) Realistic Touch Football [WIP] - Roblox

2 Likes

its just the kicking mechanic there

1 Like

Yeah, I definitely wouldn’t write out a whole kicking system. Don’t have that type of patience.

Was it this game

Yes, that was the game. I played it just to see what you were talking about. Lemme know if the code is sent works!

Do you reckon they use magnitude.