Hello. I made a gun, it is almost done, but for the last thing, I want to view the bullets. But for some reason, they won’t appear. Here is a video:
https://streamable.com/dfy7ja
Here are the line that is creating the bullets:
while wait(.1) do
if isShooting and not script.Parent.Configuration.IsOnSafe.Value and not script.Parent.Configuration.IsReloading.Value and script.Parent.Ammo.Value ~= 0 then
local rayCastParams = RaycastParams.new();
local bulletClone = script.Bullet:Clone();
bulletClone.Parent = workspace
bulletClone.Position = script.Parent.Handle.Position + script.Parent.Handle.CFrame.LookVector * 0.4
bulletClone.Anchored = false
local bodyVelocity = Instance.new("BodyVelocity");
local rayUnit = (mouse.Hit.p - bulletClone.Position).Unit * 250
bodyVelocity.Velocity = rayUnit
bodyVelocity.Parent = bulletClone
rayCastParams.FilterDescendantsInstances = {script.Parent.Parent, script.Parent}
rayCastParams.FilterType = Enum.RaycastFilterType.Blacklist
rayCastParams.IgnoreWater = true
local result = workspace:Raycast(script.Parent.Handle.Position, (mouse.Hit.p - script.Parent.Handle.Position).Unit * 250, rayCastParams);
if result == nil then return end
if result.Instance and result.Instance.Parent:FindFirstChildOfClass("Humanoid") then
damageRemoteEvent:FireServer(result.Instance.Parent:FindFirstChildOfClass("Humanoid"))
end
else
end
end