I'm making an fps game but i ran into a problem. The bullet is not forming! I used the print function to see problems but they come back with no errors as if everything worked! Here is that portion of the script.
mouse.Button1Down:Connect(function()
if debounce == false then
debounce = true
fire:Play()
wait()
fire:Stop()
local ray = Ray.new(glock.Gun.Hole.CFrame.p,(mouse.Hit.p - glock.Gun.Hole.CFrame.p).Unit * 300)
local hit, position = workspace:FindPartOnRay(ray,nil,false,false)
local bullet = Instance.new("Part",workspace)
bullet.BrickColor = BrickColor.new("Gold")
bullet.Transparency = 0
bullet.CanCollide = false
bullet.Anchored = true
bullet.Material = Enum.Material.Neon
local distance = (glock.Gun.Hole.CFrame.p - position).Magnitude
print(distance)
bullet.Size = Vector3.new(.1,0.1,distance)
print("size")
bullet.CFrame = CFrame.new(0,0,-distance / 2)
print("CFrame")
game.Debris:AddItem(bullet,1/30)
print("added")
if hit then
game.ReplicatedStorage.Events.Damagelvl1:FireServer(hit)
end
debounce = false
end
end)
end

3 comments
yo i know this isn't the answer to your problem, but i would use the fastcast module for guns, it's super easy to use and fixes all your problems. also, if you're using a localscript that may be the problem
I'll try that
^to access the mouse i'm pretty sure you have to use a localscript though, so just handle mouse stuff in a localscript and fire it to the server then do the other stuff like bullet generation and motion there