-
What do you want to achieve?
I want to make it so that whenever a player steps on a a part, it replaces with another random part from the replicated storage and removes the part that is stepped upon -
What is the issue?
I get this error, ā12:18:30.064 Workspace.UnloadedChunk(20x1x20).ChunkLoader:7: attempt to get length of a Instance value - Server - ChunkLoader:7ā -
What solutions have you tried so far?
Tried asking my friends.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ChunkFolder = game.ReplicatedStorage.Chunks
local Chunks = ChunkFolder:GetChildren()
local UnloadedChunk = script.Parent
local function ChunkLoader()
local SelectedChunk = ChunkFolder[math.random(#ChunkFolder)]
SelectedChunk:Clone().Vector3 = UnloadedChunk.Vector3
SelectedChunk.Parent = game.Workspace
SelectedChunk.Name = "LoadedChunk"
UnloadedChunk:Destroy()
end
UnloadedChunk.Touched:Connect(ChunkLoader())