here is error attempt to index field 'Parent' (a nil value)
-- the script script.Parent.Touched:Connect(function(hit) script.Parent.CanCollide = true if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 2 script.Parent:remove() end end)
the script i am using for it
local play = game.Players.LocalPlayer local char = play.Character local mouse = play:GetMouse() local fire = true script.Parent.Parent.Activated:Connect(function() while fire == true do wait() local clone = game.Workspace.lazer:Clone() local b = game.Workspace.dmg.Gun:Clone() local r = game.Workspace.dmg.flame:Clone() r.Disabled = false b.Disabled = false local x = Instance.new("BodyVelocity",clone) x.MaxForce = Vector3.new(math.huge,math.huge,math.huge) x.Velocity = mouse.Hit.lookVector* 90 clone.Parent = game.Workspace clone.Position = script.Parent.Position *Vector3.new(1,0,0) r.Parent = clone b.Parent = clone end end) script.Parent.Parent.Deactivated:Connect(function() fire = false wait(1) fire = true end)
The :Remove() feature is deprecated, use :Destroy() instead.
Make sure to have the bottom script in a LOCALSCRIPT to ensure that it can run properly. If you have any more questions please feel free to ask here again on Scripting Helpers.