I’ve run into a problem where when a part is created it doesn’t damage any players, it doesn’t detect if it is touching them.
It is a script inside a tool. The part moves and all, but it just doesn’t damage or touch.
local tool = script.Parent
local Player = tool.Parent.Parent
local damage = 25
local SpellPower = 10
local Debounce = false
tool.Activated:Connect(function()
if SpellPower > 1 and Debounce == false then
local Beam = Instance.new("Part", game.Workspace)
Beam.CFrame = Player.Character.RightHand.CFrame + Vector3.new(2,2,2)
Beam.Shape = Enum.PartType.Cylinder
Beam.TopSurface = Enum.SurfaceType.Smooth
Beam.BottomSurface = Enum.SurfaceType.Smooth
Beam.Transparency = 0.2
Beam.BrickColor = BrickColor.new("Plum")
local velocity = Instance.new("BodyVelocity")
velocity.Parent = Beam
velocity.Velocity = script.Parent.Parent.Head.CFrame.lookVector * 120
Beam.Orientation = Vector3.new(0,0,0)
wait()
Beam.Parent = workspace
Beam:SetNetworkOwner(nil)
wait()
Beam.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
print('Humanoid is taking damage!')
local humanoid = hit.Parent:FindFirstChild('Humanoid')
humanoid.Health = humanoid.Health - damage
Beam:Destroy()
end
SpellPower = SpellPower - 1
Debounce = true
wait(3)
Debounce = false
end)
end
end)