I created a raycast that makes a part and after .5 seconds i create another part with the same CFrame and size of the first one, but alot bigger. (it's a laser beam cannon im making)
However, the touched event is only working when the person who shot the laser walks through it, and not the other players.
local beamDamage = Instance.new("Part")
beamDamage.Parent = workspace
game:GetService('Debris'):AddItem(beamDamage, 20)
beamDamage.Transparency = .25
beamDamage.Anchored = true
beamDamage.CanCollide = false
beamDamage.Material = 'Neon'
beamDamage.CFrame = beam.CFrame
beamDamage.Size = Vector3.new(5,5,distance+20)
beamDamage.BrickColor = BrickColor.new("Really red")
beamDamage.Touched:Connect(function(hit)
print('touched')
if hit.Parent then
local humanoid = part.Parent:FindFirstChild('Humanoid')
if humanoid then
if canDamage == true then
humanoid:TakeDamage(80)
canDamage = false
end
end
end
end )
wait(3)
canDamage = true
this is a local script, but FE is off.

2 comments
Where do you set "beam"? Line 8 -- "Distance"? Line 9 -- "part"? Line 15
Sorry, that stuff is all created in the script. I just didnt post the whole thing because it would be alot. However, the beamDamage CFrame and size all works. it just doesnt trigger the touched event.