Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why wont the ball move where I am looking?


script.Parent.Touched:Connect(function(hit)
	print("hit")
	if hit.Parent.Humanoid then
				script.Parent.AssemblyAngularVelocity  = hit.Parent.Head.CFrame.LookVector* 10		
		
	end
end)



I am attempting to make a soccer ball, whenever I touch it, it always goes the same direction and not where I am facing, can someone explain why?

1 answer

hit.Parent.Humanoid won't work because it doesn't check the hit.Parent has a humanoid. I hope this works for you :)

local Power = 100

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		script.Parent.AssemblyAngularVelocity  = hit.Parent.Head.CFrame.LookVector * (hit.Parent.Head.Position + Vector3.new(Power,Power,Power))  
	end
end)

1 comment

0

If this works please accept the answer

This discussion is preserved as it was. New answers, comments, and votes are closed.