Part won't become transparent

I am making a script that is supposed to turn a part invisible if any of the children of the folder “TouchSpawn” are Touched

Please bear with me as I am a pretty basic scripter

local children = script.Parent.TouchSpawn:GetChildren()

for index, Instance in pairs(children) do
	print(index, Instance)
	if Instance:IsA("BasePart") then
		children.Touched:Connect(function(hit)
			if hit.Parent:FindFirstChild("Humanoid") then
				script.Parent.SpawnCircle.Transparency = 1
			end
		end)
	end
end

that is what I have so far, I couldn’t figure out how to fix it, if anyone has any tips please let me know!

Made some adjustments to your script. Now, whenever any part within the TouchSpawn folder is touched by an object with a Humanoid parent, the SpawnCircle becomes transparent.


local folder = script.Parent.TouchSpawn
local children = folder:GetChildren()

for _, child in ipairs(children) do
    if child:IsA("BasePart") then
        child.Touched:Connect(function(hit)
            local humanoid = hit.Parent:FindFirstChild("Humanoid")
            if humanoid then
                folder.SpawnCircle.Transparency = 1
            end
        end)
    end
end
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.