How would I go about kicking a ball?

Is it a server script and not a local script? It should not be local

It is not a LocalScript 300000000000000000000

Strange, make sure the lines aren’t incorrectly entered like
local cheese = cheese.cheese.cheese.cheese.cheese

like that where it goes to the next sentence, could you send me a screenshot of the script in studio?


I don’t know why I set the LookVector * Value so high but that’s the script

Yup, after if hit.Parent == it goes to the next sentence, put it back to the sentence

Would you mind sending a screenshot of what the script is supposed to look like?

Let me try something,

function kick(hit)
  local players = game:GetService("Players")
  if players:GetPlayerFromCharacter(hit.Parent) then 
script.Parent.Velocity = hit.Parent:WaitForChild("HumanoidRootPart").CFrame.LookVector * 10

    end
end
script.Parent.Touched:Connect(kick)

this should work i made a little mistake

Does this work correctly? @Lostnfon

It does, however, is there a way to make it shoot in the direction the player is moving and not where the camera is looking?
I’m a shift-lock player and it is kindof weird when the ball is behind you and the ball just pushes you forwards.
It’s almost perfect!
I can disable shiftlock and it would work but I know many people, like myself who use shiftlock regularly and I think the game would be better if you could use shiftlock.

That’s more a roblox problem, it should shoot the direction you’re moving

Ok, is there room for a wait timer? I think it would be useful lol
Just wondering where would be a good place that wouldn’t break the script?

I have one fix which might work:

local debounce = false
function kick(hit)
if not debounce then
  local players = game:GetService("Players")
  if players:GetPlayerFromCharacter(hit.Parent) then 
script.Parent.Velocity = hit.Parent:WaitForChild("RightFoot").CFrame.LookVector * 10
debounce = true
wait(5)
debounce = false
end

    end
end
script.Parent.Touched:Connect(kick)
1 Like

A cooldown for the kick? I can add that

1 Like

there, added a cooldown for you

I’m also wondering if there’s a way to keep the player from climbing up the ball when he moves towards it facing towards the ball.

Turn can collide off in the properties tab

wouldn’t the ball fall through the map then?

1 Like

Yes it does 3000000000000000000

Hm yeah, well another solution maybe:
Turn collission group IDs on in workspace properties, change the collission group ID of the ball to 2 or something else and place invisible walls with the same IDs