Basically, it should be removing the parts and play a little animation
Here is my code:
local PartsFolder = script.Parent.DisapearingParts
local Parts = PartsFolder:GetChildren()
while wait(2) do
local index = math.random(1, #Parts)
local PickedPart = Parts[index]
local index2 = math.random(1, #Parts)
local PickedPart2 = Parts[index2]
table.remove(Parts, index)
PickedPart.Color = Color3.fromRGB(255, 0, 0)
PickedPart.Material = "Neon"
wait()
for i = 0, 1.05, 0.05 do
PickedPart.Transparency = PickedPart.Transparency + 0.05
wait()
end
PickedPart.CanCollide = false
table.remove(Parts, index2)
PickedPart2.Color = Color3.fromRGB(255, 0, 0)
PickedPart2.Material = "Neon"
wait()
for i = 0, 1.05, 0.05 do
PickedPart2.Transparency = PickedPart2.Transparency + 0.05
wait()
end
PickedPart2.CanCollide = false
end
Well, the error states that #Parts is empty, which essentially means 0.
How are these parts being created? If the client creates these parts, but the server tries to gather them. It will appear empty to the server, as the client cannot directly alter the server’s state.
If the map is cloned by the client, it’s not shared with the server. The cloned instance will only be visible to the client that cloned it.
If you want the whole server to see the same instance, you’d need to have the map instance on the server. Then, you could alter the map with a ServerScript.
Alternatively, you can create a system to pass data to the clients, instructing the client machines on which parts to modify on the map. The parts to modify would be decided by the server. However, this is a more exploitable route.
I recommend keeping the map on the server (Workspace), and altering it with a ServerScript. Don’t have the client clone the map.
It is cloning the map from the server, and placing it in workspace, inside of the map model I have the deleting script, shown here. https://i.imgur.com/ufvuct4.png
After around half of the parts are gone it errors.