i made a script that makes a light ball but now i want it to deal damage then i tried to use a .Touched event, but the .Touched event is invalid to localscript and script can someone tell me how to make the ball deal damage without the .Touched event ? This is my script
Light ball (LocalScript)
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
function OnKeyDown(key)
key = key:lower()
if key == 'z' then
x = Instance.new('Part')
x.TopSurface = 'Smooth'
x.CanCollide = false
x.BottomSurface = 'Smooth'
x.Shape = 'Ball'
x.Material = 'Neon'
x.Size = Vector3.new(2.51, 2.51, 2.51)
x.BrickColor = BrickColor.new('Deep orange')
x.Parent = game.workspace
pt = Instance.new('PointLight',x)
pt.Brightness = 10000000
pt.Range = 20
pt.Color = Color3.new(Color3.fromRGB(255,255,0))
p = Instance.new('ParticleEmitter')
p.Parent = x
p.Rate = 5
p.Texture = 'rbxgameasset://Images/ParticleTest'
p.Color = ColorSequence.new(Color3.fromRGB(255,255,0),Color3.fromRGB(255, 170, 0))
p.VelocitySpread = 360
p.Speed = NumberRange.new(3)
p.Lifetime = NumberRange.new(2.1,5)
p.Size = NumberSequence.new(1)
p.Transparency = NumberSequence.new(0.16)
p.LightEmission = 1
y = Instance.new('BodyVelocity')
y.maxForce = Vector3.new(math.huge,math.huge,math.huge)
y.velocity = plr.Character.UpperTorso.CFrame.lookVector
y.Parent = x
x.CFrame = plr.Character.UpperTorso.CFrame*CFrame.new(0,0,-3)
wait(15)
x:remove()
end
end
mouse.KeyDown:connect(OnKeyDown)
--Damage (Script inside the LocalScript)
function Damage(l)
if l.Parent:FindFirstChild('Humanoid') then
for i = 1,30
l.Parent.Humanoid.Health = l.Parent.Humanoid.Health - 1
end
end
script.Parent.Touched:connect(Damage)

3 comments
Have you tried adding a code that will clone the damage script into the ball after it's been fired? i.e. The server-side is within the localscript, and the localscript clones the damage script into the ball. Also, your damage function isn't set up to deal damage.
oh yeah sorry i was trying too much things then to decrease the code size i put print to see if the .Touched works.
and no.I didnt try. thanks.