I am currently trying to make a script that when touched by player disappears then comes back after a while, I have the code all in and it works, now I am currently trying to duplicate the part.
The problem is that when I duplicate the part the script doesn’t save through, and personally I would it so its only one script changing all the parts when touched by a player.
I have tried duplicating the part that doesn’t save the script though, I looked up a solution and I came across someone who had a similar problem, the answer was to use a plugin with tags, but I would rather not use a plugin if possible
I would personally do something along the lines of putting all of the parts you want this script to run on in a folder/model and then writing one script that runs code for all of them. For example, lets say its a folder in workspace named “TouchParts”. We can write code for this:
for _, part in pairs(workspace.TouchParts:GetChildren()) do
part.Touched:Connect(function()
--Code for that
end)
end
So it works, But I have a debounce in my script and it makes it not able to do more than one at a time when I take it out it works but because the debounce is gone it makes it seem a little bit glitchy
Ok! You can have a debounce inside of each part then.
for _, part in pairs(workspace.TouchParts:GetChildren()) do
local debounce = false
part.Touched:Connect(function()
if not debounce then
debounce = true
--Code for that
wait(whatever time it is)
debounce = false
end
end)
end
Ok thank you ill try, also on your post up top you said “(post withdrawn by author, will be automatically deleted in 1 hour unless flagged)” what does that mean?