-
What do you want to achieve?
I want the ball to shoot the way where your mouse cursor is, but only to your front. So you cant shoot the ball backwards. -
What is the issue?
I cant reference mouseHit accordingly and dont know all the steps -
What solutions have you tried so far?
I have researched a lot, but couldnt find an answer, and I basically just tried and error
Server script:
shot = game.ReplicatedStorage.Remotes.ShootBall.OnServerEvent:Connect(function(player, KickMeter, MouseHit) -- KickMeter
local PlrStats = player:WaitForChild("PlrStats")
local Power = PlrStats.Power.Value
local anim = animations.Kick
player.Character.Humanoid.Animator:LoadAnimation(anim):Play()
wait(0.52)
if attached == true then
ball.Position = ball.Position + Vector3.new(0.5,-0.3,-0.15)
if ball.Parent.Name == "GetBallHitbox" then
ball.CanCollide = true
ball.Parent:WaitForChild("WeldConstraint"):Destroy()
end
ball.Parent = workspace
ball.CanTouch = false
ball.Velocity = player.Character.HumanoidRootPart.CFrame.LookVector * ((Power + 65) * (KickMeter / 10))
speeding = true
wait(0.5)
ball.CanTouch = true
attached = false
ball.CanCollide = true
debounce = false
print((Power + 65) * (KickMeter / 10))
end
end)
Then I send this from a local script
game.ReplicatedStorage.Remotes.ShootBall:FireServer(KickMeter.Value, mouse.Hit.Position)