If anybody who know raycast will know that it can make a bullets (parts) like a prison life gun, but in prison life, you can shoot to skybox and will appear a bullets, but when i tried doing the bullets, it will go to the midpoint (which skybox are infinite) so you cannot see a bullet. Any Idea how to fix this?
code:
event.OnServerEvent:connect(function(play, mouse) local origin = handle.Position local direction = (mouse.p - handle.Position).Unit * (mouse.p - handle.Position).Magnitude local ray = Ray.new(origin,direction) local impact = game.Lighting.Bullet:Clone() local midpoint = origin + direction/2 impact.Size = Vector3.new(0.2,0.2,(mouse.p - handle.Position).Magnitude) impact.CFrame = CFrame.new(midpoint,mouse.p) --impact.Mesh.Scale = Vector3.new(1,1,(mouse.p - handle.Position).Magnitude) impact.Parent = game.Workspace.Bullets local hit,Position = workspace:FindPartOnRayWithIgnoreList(ray, {char, impact, tool, game.Workspace.Bullets}) if hit then if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= tool.Parent.Name then if debounce == true then debounce = false if hit.Name == "Head" or hit.Name == "Face" then hit.Parent.Humanoid:TakeDamage(60) wait(0.05) debounce = true else hit.Parent.Humanoid:TakeDamage(30) wait(0.05) debounce = true end end end end script.Parent.Hole.Sound.TimePosition = 0 script.Parent.Hole.Sound:Play() game:GetService("Debris"):AddItem(impact, 0.05)