so i orginally had a script in every single tile for my spleef minigame but i wanted to change that. so when i moved it into one script with some code adjustments, the script just wasnt working
tile = script.Parent:GetChildren("Tile")
for i = 1, #tile do
tile[i].Touched:Connect(function()
wait(0.35)
tile[i]:Destroy()
end)
end
I placed a bunch of parts, grouped them together, and put that script as a child of the model instance. I didn’t put the script in each individual tile. Could you show me what your explorer (only the tiles model) looks like?
Touched is not a valid member of Folder "Workspace.Spleef.Spawns" - Server - TileScript:4
Stack Begin - Studio
Script 'Workspace.Spleef.TileScript', Line 4 - Studio - TileScript:4
Stack End
Try adding a short bit of code that acts as a filter to sort out the non-parts.
tile = script.Parent:GetChildren("Tile")
for i = 1, #tile do
tile[i].Touched:Connect(function()
if tile[i]:IsA("BasePart") then --checks if the touched part really is a part
wait(0.35)
tile[i]:Destroy()
end)
end
end
The problem with your script isn’t actually in the script. The problem is that there is a “Spawns” folder, and as you know, folders can’t be touched.