Here is my script:
local Tool = script.Parent
Tool.RemoteEvent.OnServerEvent:Connect(function(player, pos)
local part = Instance.new("Part")
part.Parent = Tool
part.Anchored = true
part.Transparency = 1
part.CanCollide = false
part.Massless = true
part.Size = Vector3.new(1,1,1)
part.Position = pos
local point2 = Instance.new("Attachment")
point2.Name = ("Ending Point")
point2.Parent = part
Tool.Magic.Beam.Attachment1 = point2
point2.WorldPosition = part.Position
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid")then
hit.Parent.Humanoid:TakeDamage (20)
wait(0.05)
part:Destroy()
end
end)
wait(0.5)
part:Destroy()
end)
I put this script in a tool, the pos is sent from my local script and it is the mouse.hit.position. My weapon is to create a lazer when clicked. There is no error to the script. When I shoot at a place and then I walk to it, it damages me but when I hit a player that is standing still, it doesn't do any damage. How can I fix this?

2 comments
Is it meant to damage others or yourself? Have you tried with multiple players/NPC's?
Yes, it is meant to damage others and I have tried it on many NPC but not players