I'm having a issue in try to make a soccer game

I’m tryng to make a ball fix in player and with this the player be able to kick the ball, in there its ok i made but somethings its simply dont working

this things are

the ball dont go out in the direction of whas character turned
after kick the ball i cant get back
its in a local script and i dont know how to adapt to a normal script to show the event to every servrer

StarterGui script:

local player = script.Parent.Parent

local mouse = player:GetMouse()

local Who = game.ReplicatedStorage.HoldingBall.Who

local holding = false

mouse.Button1Down:Connect(function()

	if Who.Value == player.Character then
		holding = true
		script.ThrowForce.Value = script.ThrowForce.Value + 1
		print("in")
		task.wait(0.2)
		repeat script.ThrowForce.Value = script.ThrowForce.Value + 15 wait() until  holding == false

	end

end)

function kick()

	if holding == true then
		if Who.Value == player.Character then
			local cf =   game.Workspace.Ball.CFrame
			game.Workspace.Ball.BallAttach.Part0 = nil
			task.wait(0.1)
			local force = Instance.new("VectorForce")
			force.Parent = game.Workspace.Ball
			force.Attachment0 = game.Workspace.Ball.Attachment
			force.ApplyAtCenterOfMass = true
			force.Force = Vector3.new(script.ThrowForce.Value,script.ThrowForce.Value,script.ThrowForce.Value) * cf.LookVector --my problem is here
			print("out")
			holding = false
			Who.Value = game.ReplicatedStorage.HoldingBall.Nule
			task.wait(0.2)
			script.ThrowForce.Value = 0
			force:Destroy()

		end
	end

end



mouse.Button1Up:Connect(function()
	kick()
end)

BallScript:

script.Parent.Touched:Connect(function(plr)
	if plr.ClassName == "MeshPart" then
		local char = plr.Parent
		script.Parent.BallAttach.Part0 = char.HumanoidRootPart
		game.ReplicatedStorage.HoldingBall.Who.Value = plr.Parent
	end
end)
1 Like

have also the same problem here

1 Like

You are supposed to fire a remote event. Then on the server add a body veloci and set it to the character root part cframe basically

local velo = instance.new(“BodyVelocity”)
velo.MaxForce = Vector3.new(100000,0,10000)
velo.Velocity = Character.HumanoidRootPart.CFrame.LookVector * 90
velo.Parent = ball

also your deleting the attach on client so it doesnt affect the server

2 Likes