I made a gun that shoots. It works, but it doesnt show the beam/bullet. Can someone help me? thanks!
script:
local isincar = false local mouse = game.Players.LocalPlayer:GetMouse() local player = game.Players.LocalPlayer mouse.Button1Down:Connect(function() local h = script.Parent:WaitForChild("cAr").Value.Parent.Parent.Body.lala local ray = Ray.new(h.CFrame.p, (mouse.Hit.p - h.CFrame.p).unit * 300) local part, position = workspace:FindPartOnRay(ray, player.Character, false, true) local b = Instance.new("Part") b.BrickColor = BrickColor.new("Bright yellow") b.FormFactor = "Custom" b.Material = "Plastic" b.Transparency = 0 b.Anchored = true b.Locked = true b.CanCollide = false local distance = (h.CFrame.p - position).magnitude b.Size = Vector3.new(0.3, 0.3, distance) b.CFrame = CFrame.new(h.CFrame.p, position) * CFrame.new(0, 0, -distance / 2) game:GetService("Debris"):AddItem(b, 0.1) if part then local humanoid = part.Parent:FindFirstChild("Humanoid") if not humanoid then humanoid = part.Parent.Parent:FindFirstChild("Humanoid") end if humanoid then humanoid:TakeDamage(30) end end end)