Ok so I have made a “gun” tool and I’ve made it work but there is a problem, the bullet comes out after like a .5 sec lag thingy
(As you can see the bullet is coming out after a delay)
Here is a video of it showing :
My code is here :
Local
script.Parent.Parent.Activated:Connect(function()
script.Parent:InvokeServer()
end)
Server
script.Parent.OnServerInvoke = function()
local newBullet = Instance.new("Part")
newBullet.CanCollide = false
newBullet.Material = Enum.Material.Neon
newBullet.Size = Vector3.new(0.5,0.5,1.5)
newBullet.BrickColor = BrickColor.Red()
newBullet.Parent = workspace
newBullet.CFrame = script.Parent.Parent.PointOut.CFrame + script.Parent.Parent.PointOut.CFrame.LookVector
local bodyPosition = Instance.new("BodyPosition")
bodyPosition.Parent = newBullet
bodyPosition.D = 15000
bodyPosition.Position = script.Parent.Parent.PointOut.CFrame.Position + (script.Parent.Parent.PointOut.CFrame.LookVector * 1250)
end
I’m trying to look for some help please if you know how to fix it reply it to this and thank you for reading my post!