- 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.
- 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.
- 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