So I was creating a script, Full code is now included, sorry.
local tool = script.Parent local handle = tool:WaitForChild("Handle") local Rdy = tool:WaitForChild("Ready") local beam = tool:WaitForChild("Beam") local smoke = beam:WaitForChild("Smoke") local rel = beam:WaitForChild("Reloading") local fir = beam:WaitForChild("Blast") local bep = beam:WaitForChild("Beep") local plr = tool.Parent.Parent local char = plr.Character or plr.CharacterAdded:Wait() local DS = game:GetService("Debris") tool.Activated:Connect(function() if Rdy.Value == true then Rdy.Value = false rel:Play() beam.BrickColor = plr.TeamColor wait(4.5) for a = 1,50 do local bullet = Instance.new("Part",workspace) fir:Play() bullet.Size = Vector3.new(.1,.1,1) bullet.BrickColor = plr.TeamColor bullet.Material = "Neon" bullet.CFrame = beam.CFrame + Vector3.new(0,0,-1.5) bullet.Velocity = beam.CFrame.lookVector * 250 bullet.Touched:Connect(function(hitpart) if hitpart.Parent:FindFirstChildOfClass("Humanoid") then local h = hitpart.Parent:FindFirstChildOfClass("Humanoid") local hplayer = game.Players:GetPlayerFromCharacter(hitpart.Parent) if hplayer.TeamColor ~= plr.TeamColor then print("Bullet hit "..hitpart.Parent.Name.."!") h:TakeDamage(2) end end DS:AddItem(bullet,2) end) end beam.BrickColor = BrickColor.new("Really black") wait(10) beam.BrickColor = BrickColor.new("Br. yellowish orange") for a = 1,5 do bep:Play() wait(.5) end wait(1) beam.BrickColor = BrickColor.new("Shamrock") Rdy.Value = true end end)
Nothing seems wrong in it, yet whenever the bullet touches things it just displays " Players.gamemaster60788.Backpack.Power Cannon.Main:28: attempt to index field 'Parent' (a nil value)"
Any help?