Hello! My name is Light and I am a new developer trying to learn how to script.
my goal in the script below was to spawn a bullet everytime this function was ran, the bullet is created perfectly fine but the issue seems to be something with the velocity but im not really sure. When the bullet is created there is a short delay before the bullet actually starts travelling which makes the bullet look laggy or broken. I spent a little bit of time on the forum searching for the issue but didn’t find much that directly related to this, could someone help?
here is a video for reference: https://streamable.com/rpvbz6
and here is the link to the place if you want to see it for your self: Portfolio - Roblox
Below is the script I am using to make the bullet, it’s located in ServerScriptService
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DebrisService = game:GetService("Debris")
local fireEvent = ReplicatedStorage:WaitForChild("FireEvent")
fireEvent.OnServerEvent:Connect(function(player, gunPos, mosPos)
local bullet = Instance.new("Part", workspace)
bullet.Name = "Bullet"
bullet.FormFactor = Enum.FormFactor.Custom
bullet.Shape = Enum.PartType.Cylinder
bullet.Size = Vector3.new(0.5, 0.25, 0.5)
bullet.BrickColor = BrickColor.new("Gold")
bullet.Material = "Neon"
bullet.CFrame = CFrame.new(gunPos, mosPos)
bullet.Velocity = bullet.CFrame.lookVector * 750
DebrisService:AddItem(bullet, 5)
end)
Any help is appreciated!