I have a loading script, it just won't work.... In the player I have a folder called "SaveMonsters" In the folder I have a bunch of int values, i have another folder with a bunch of models with the same name as the Int values,
The models should clone and moved to workspace by the amount of their int value, It won't work, any help on why? I get stuck at the for loop
game.Players.PlayerAdded:connect(function(player)
local monsters = player:WaitForChild("SaveMonsters")
local tableOfMonstersRetrieved = monsters:GetChildren()
for _, v in pairs(tableOfMonstersRetrieved) do
local potentialMatch = game.ReplicatedFirst.CharactersLevelOne:FindFirstChild(v.Name)
wait()
--if TheValue then
if v.Value < 1 then
print("Can't Clone "..v.Name.." because character has none")
else
if potentialMatch then
local a = Instance.new("IntValue", workspace)
a.Value = v.Value
repeat
a.Value = a.Value - 1
potentialMatch:Clone().Parent = workspace.Monsters
TheValue.Value = TheValue.Value + 1
until a.Value < 1 --or TheValue.Value >= 10
wait(1)
repeat
wait(.5)
potentialMatch:Clone().Parent = workspace.Monsters
until a.Value < 1
if a.Value < 1 then
a:Destroy()
end
print("Finished Placing "..v.Name)
--end
end
end
end
end)
print("Sucessfully finished loading player data")
It won't print the items in the for loop nor will it print the very last print, any help...?

2 comments
Important values should not be stored in a vulnerable place, use ServerStorage or variables.
oh okay, thanks