I don't know why projectile is not going infront of player when player is moving backward

  1. What do you want to achieve? Keep it simple and clear!

With player facing mouse curser everytime, I want to make projectile goes the way player is facing but this seems to only work out when player is going same way as projectile is going.

  1. What is the issue? Include screenshots / videos if possible!

It just seems sometimes projectile dosen’t go forward but goes to side when player is going opposite direction of projectile.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I couldn’t seem to figure out any information to this problem.

– local script for player facing mouse curser

game:GetService("RunService").RenderStepped:Connect(function()
local Character = player.Character
Character:SetPrimaryPartCFrame(CFrame.new(Character.PrimaryPart.CFrame.Position, Vector3.new(mouse.Hit.Position.X, Character.PrimaryPart.CFrame.Position.Y, mouse.Hit.Position.Z)))

end)

–script inside of SSS that sends projectile

local ice = game.ServerStorage:WaitForChild("Ice")

game.ReplicatedStorage.Ice.OnServerEvent:Connect(function(player)
local character = player.Character

local newIce = ice:Clone()
	
newIce.Parent = game.Workspace
local offset = Vector3.new(math.random(-2,2),0,-10)

newIce.CFrame = character.HumanoidRootPart.CFrame*CFrame.new(offset)
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.MaxForce = Vector3.new(3000,3000,3000)
bodyVelocity.Velocity = (character.HumanoidRootPart.CFrame.lookVector*50)
bodyVelocity.Parent = newIce
	
newIce.Touched:Connect(function(hit) 
	if hit.Parent:FindFirstChild("Humanoid") then
		if hit.Parent.Name ~= player.Name then
			hit.Parent.Humanoid:TakeDamage(10)
			newIce:Destroy()
		end
	end
end)

wait(0.8)
	

newIce:Destroy()

end)

video for detail https://streamable.com/6z9r23

when I don’t enable scatter shots, outcome: https://streamable.com/exnz5l

Make the projectile on the client, this is happening because there’s a delay between the client and the server.

If that doesn’t work, try to set the network ownership of “newIce” to nil.

I tried out changing the network owenership of my projectile to nil, it didn’t worked out and outcome was same. If this is because of delay, why is it only not working when I walk backwards?

I did some research right now and learned turning projectile to client-side is better but how would I make projectile on the client?

Yea massless of newIce is false

I believe the character has odd rotational behavior when moving backwards. Instead of using the LookVector of the HumanoidRootPart, do the same calculation you used to set the HumanoidRootPart CFrame.

CFrame.new(Character.PrimaryPart.CFrame.Position, Vector3.new(mouse.Hit.Position.X, Character.PrimaryPart.CFrame.Position.Y, mouse.Hit.Position.Z))

See if this works better.

Ok ill try this solution ||||||||||||||||||||||||

Instead of using a wait to destroy stuff write game.Debris:AddItem(newIce,0.8) this adds it for 0.8 seconds then destroys it its better

1 Like

Although with some research, I found the solution for this problem by setting humanoid.AutoRotate to false makes this not happen but I learned lot from reply from post from everyone so thank you guys!