Ive had this same problem yesterday which i solved. But not today i tried using linear force my projectile still curves even though the maxforce is set to inf. And it happens randomly too
1st video test:
robloxapp-20240627-2213083.wmv (911.3 KB)
2nd video test where it bugged out:
robloxapp-20240627-2213354.wmv (1.3 MB)
Code:
local Pistol = script.Parent
local Event = Pistol.BulletEvent
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Cooldown = false
local Debris = game:GetService("Debris")
local Bullet = game.ReplicatedStorage.Bullet
local Character = Player.Character
local HRP = Character.HumanoidRootPart
local Sound = Pistol.Sound
Pistol.Activated:Connect(function()
if Cooldown == false and Mouse.Hit ~= nil then
Cooldown = true
local ShotSound = Sound:Clone()
ShotSound.Parent = Pistol
ShotSound:Play()
local Direction = (Mouse.Hit.Position - Pistol.FirePart.Position).Unit
local NewBullet = Bullet:Clone()
NewBullet.Position = Pistol.FirePart.Position
NewBullet.Parent = workspace
NewBullet.Orientation = Direction
local LinearVelocity = Instance.new("LinearVelocity")
LinearVelocity.Attachment0 = NewBullet.Attachment
LinearVelocity.Parent = NewBullet
LinearVelocity.VectorVelocity = Direction * 1000
LinearVelocity.MaxForce = math.huge
Debris:AddItem(NewBullet, 10)
task.wait(2)
Cooldown = false
ShotSound:Destroy()
else
return
end
end)
like i said the code wasnt changed at all in these videos so if anyone knows why this happens please let me know