How would I go about kicking a ball?

I did not write this script this was written by DeRobloxMeneer

1 Like

This is in consistent.
If the player is R6 or another rig it does not have a HumanoidRootPart.

Atleast I’ve never had a r6 rig with a HumanoidRootPart

Would you mind writing out the new script so I can make sure I’m doing it right? Just so I know exactly where you’re saying to put what
does r6 not work?


Nah it has a humanoid root part, it’s vital otherwise you can’t really animate.
oh yea here’s the new script double check it with r6

script.Parent:SetNetworkOwner(nil) -- if you don't do this the physics goes wack when you transfer ownership
local velocity = 100 -- easier to change in the future
local debounce = false
function kick(hit)
	if not debounce then
		local players = game:GetService("Players")
		if players:GetPlayerFromCharacter(hit.Parent) and hit.Parent:FindFirstChild("HumanoidRootPart") then 
			script.Parent:ApplyImpulse(hit.Parent.HumanoidRootPart.CFrame.LookVector * velocity* script.Parent:GetMass())
			debounce = true
			wait(2.5)
			debounce = false
		end

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

Strange, when I used roblox’s build rig and placed a r6 rig it didn’t have a HumanoidRootPart? Well that’s something for later but does this one go up too? I’m interested in how to apply multiple forces even with lookvector

Looks great! one thing, what is ownership on line 2? Just wondering if I can take that out
hm, only line 2 it says ownership for some reason when I pasted it

Don’t remove it, the thing with the roblox physics engine is it sometimes lets the user simulate physics, if you apply a force on the server and the client has ownership, it wouldn’t do anything. heres the article

1 Like

It’s one word on it’s own line
on line 2 it just says “ownership” and nothing else. It comes up as a syntax error

let me just post pure code I think the comments is extending itself

script.Parent:SetNetworkOwner(nil) 
local velocity = 100 -- easier to change in the future
local Players = game:GetService("Players")
local debounce = false
function kick(hit)
	if not debounce then
		if Players:GetPlayerFromCharacter(hit.Parent) and hit.Parent:FindFirstChild("HumanoidRootPart") then 
			script.Parent:ApplyImpulse(hit.Parent.HumanoidRootPart.CFrame.LookVector * velocity* script.Parent:GetMass())
			debounce = true
			wait(2.5)
			debounce = false
		end

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

I think that’s everything guys! Tysm for helping me.
It works great and you’re legends!

1 Like

How would you make so that you can hit the ball except the parent is anchored?