Does anybody know how to fix this touch script not working?

I’m trying to make a spark system for lightsabers and I can’t seem to make a script that makes it enable when touching a part.
Script:

local sparks = script.Parent.Parent:FindFirstChild("Part").Sparks
local blade = script.Parent
local otherPart = game.Workspace.Part

sparks.Enabled = false

local function OnTouch(otherPart)
	sparks.Enabled = true
end

Video:


Layout of scripts and stuff in the video.

1 Like

Try adding a humanoid to the part you’re touching.

1 Like

I found error, use (part).Touched:Connect(function() as

local sparks = script.Parent.Parent:FindFirstChild("Part").Sparks
local blade = script.Parent
local otherPart = game.Workspace.Part

sparks.Enabled = false

local function OnTouch(otherPart)
	sparks.Enabled = true
end

blade.Part.Touched:Connect(OnTouch)
1 Like

But note that this works on players, so if you don’t want that, do a check