What do you want to achieve?
I want the bullet to break the block and remove the light
What is the issue?
I have no idea how to modify the script so that the bullet turns off the light.
What solutions have you tried so far?
I tried to put a “Parent” but failed
--
local _glass = script.Parent
local point = script.Parent.PointLight
function touch(other)
local hum = other.Parent:FindFirstChild("NewBullet")
if hum then
point.Enabled = false
end
end
_glass.Touched:Connect(touch)
I don’t think .Touched work with anchored parts/when your bullet hits an anchored part. You can try raycast or just turn off the light after a certain amount of time.
To make the bullet hit the block, the touched function atleast fires when both parts (the part that has a touched function and the one who made in contact) intersect or make in contact.
Anyways your script is right but the only thing wrong is that your getting the parent of the part that started the fire of the touched function so you should instead write object instead of object.Parent.
Where does the part breaking occur? The code you provided only appears to be for the light.
You should put the code to turn off the light in the same code as the breaking of the part if you want them to happen at the same time in response to the same event.
Also, when the bullet is fired, it will not be in that replicated storage folder anymore, so be careful with looking for a child inside its parent, as the parent will not be the Projectiles folder.