Hi, I've been trying to make a gun but it doesn't damage players. Local Script
local Gui = script.Parent:WaitForChild("ScreenGui")
local Ammo = 4
local WaitTime = 1
local StoredAmmo = 3
local ShootPart = script.Parent.ShootPart
local mouse = game.Players.localPlayer:GetMouse()
script.Parent.Parent.Equipped:Connect(function(Mouse)
animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
GuiClone = Gui:Clone()
GuiClone.Parent = game:GetService("Players").LocalPlayer.PlayerGui
animation:Play()
animation.Looped = true
end)
script.Parent.Parent.Activated:Connect(function(Mouse)
animation2 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation2)
GuiClone.Frame.TextLabel.Text = Ammo.."|"..StoredAmmo
GuiClone.Enabled = true
script.Parent.Sound:Play()
ammoCheck()
Ammo = Ammo - 1
shoot()
animation2:Play()
wait(WaitTime)
end)
script.Parent.Parent.Unequipped:Connect(function()
animation:Stop()
animation.Looped = false
GuiClone.Enabled = false
end)
function reload()
StoredAmmo = StoredAmmo - 1
Ammo = 4
animation3 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation3)
animation3:Play()
if StoredAmmo < 1 then
GuiClone.Frame.TextLabel.Text = "No more ammo"
wait(1.5)
animation:Stop()
animation2:Stop()
GuiClone:Destroy()
script.Parent.Parent:Destroy()
end
end
function ammoCheck()
if Ammo < 1 then
reload()
end
end
function shoot()
local Bullet = Instance.new("Part", workspace)
Bullet.Size = Vector3.new(0.3, 0.05, 0.1)
Bullet.BrickColor = BrickColor.new("New Yeller")
Bullet.Material = Enum.Material.Neon
Bullet.Position = ShootPart.Position
Bullet.Name = "Bullet"
local Force = Instance.new("BodyVelocity")
Bullet.CFrame = CFrame.new(mouse.hit.p) + Vector3.new(0,1,0)
wait(2)
Bullet:Destroy()
end
Script for damage
local Brick = workspace.Bullet
local function PlayerTouched(Part)
local Parent = Part.Parent
if game.Players:GetPlayerFromCharacter(Parent) then
Parent.Humanoid.Health = Parent.Humanoid.Health - 10
end
end
Brick.Touched:connect(PlayerTouched)

5 comments
it doesn't damage them, but it's because of this error 13:24:13.569 - Bullet is not a valid member of Workspace
(didn't mean to hit enter) but Bullet is in the Workspace
The script actually loads faster than the object so use Workspace:WaitForChild("Bullet")
i don't get the error, but it won't damage the npc/player still
should I make another post for this?