Hello everyone, I have problem with ontouch script. It should make supply chest disapear, but don't work ;s Im beginner in scripting and tried to make "advanced script"... Later i'll try to add that chest will give player weapon from lighting, but first i want to make disapear.
Here is script:
local DebounceTime = 0.5
local Debounce = false
local Sup = script.Parent.Parent.Supply
local OnTouch = function(Part)
local Humanoid = Part.Parent:FindFirstChild("Humanoid")
if Humanoid then
local Player = game.Players:GetPlayerFromCharacter(Humanoid.Parent)
if Player then
if not Debounce then
Debounce = true
for i = 1, 36 do
local Del = Sup:FindFirstChild("S"..i)
Del.Transparency = 1
Del.CanColide = false
end
end
wait(DebounceTime)
Debounce = false
end
end
end
script.Parent.Parent.Supply.Touched:connect(OnTouch)
Probably everything is wrong, but if someone can help.

5 comments
Is there an error in the output?
Yeah error in output is in line 15.
But what does it say?
Make sure that there are 36 parts named S1, S2, S3, and so on. Make sure that those parts are direct children of "Supply". In general, make sure your hierarchy is correct.
Everything is correctly.