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)