I have this bullet Instantiation script, which is supposed to put a bullet into the workspace and move it a set velocity. The problem ^^^ is that its velocity takes effect a few milliseconds after it appears in the workspace. There is no wait statement anywhere in the instantiation, and there arent any intense calculations.
local bolt = bullet:Clone()
if bolt:FindFirstChild("BodyVelocity") then
local force = bolt.BodyVelocity
local sound = bolt.Sound
--local effect = bolt.Fire
sound.Parent = script
--effect.Parent = script
bolt.CFrame = pos
force.Velocity = bolt.CFrame.LookVector * speed
bolt.Parent = game.Workspace
Debris:AddItem(bolt, 5)
local part = Instance.new("Part")
part.Transparency = 1
part.Anchored = true
part.CanCollide = false
part.Parent = game.Workspace
part.Position = pos.p
sound.Parent = part
--effect.Parent = part
sound:Play()
Debris:AddItem(part, 1)
--Debris:AddItem(effect, 0.2)
bolt:SetNetworkOwner(nil)
else
warn("No BodyVelocity for bullet; add to prefab")
bolt:Destroy()
end
Video | | |
vvv
*projectile in video was resized for better visibility