Hello.Yes, its me again. I am trying to make one of those popular "Difficulty Chart Obbies." So here, i am playing with stage saving and completition. What i am trying to do is when a player joins the game all his data gets loaded and the completed stages turn green only for his client. However, this error is preventing me to do that. I have tried using delays, pcalls, if statements and still nothing.This error is really getting me annoyed :(. I am using remote events because as i expect it would fire to the client and not confuse other players.
Remote event definer script (Located is starterPlayerScripts):
game.ReplicatedStorage.PadColorChange.OnClientEvent:Connect(function(plr, StagesValue)
print("started")
local BeatenStages = {}
if StagesValue == 1 then
game.Workspace[1].BrickColor = BrickColor.new("Lime green")
end
local success, errormsg = pcall(function()
for i = 1,StagesValue do --Line error
table.insert(BeatenStages, i)
print("Inserted "..tostring(i))
end
end)
if success then
for _, v in pairs(BeatenStages) do
for _, m in pairs(game.Workspace:GetChildren()) do
if m.Name == tostring(v) and m:IsA("Part") then
m.BrickColor = BrickColor.new("Lime green")
print("Color Changed")
end
end
end
else
warn("Error: "..errormsg)
end
end)
And where i pass the parameters (Its just a fragment of code but i am sure you will understand):
if Data["Stage"] and Data["Level"] then
Stage.Value = Data["Stage"]
Level.Value = Data["Level"]
print(Stage.Value)
print("Loaded "..PlayerKey.." key successfully!")
wait(1)
game.ReplicatedStorage.PadColorChange:FireClient(Player, Stage.Value)
Thanks. If you need more information ask.

1 comment
Oh thanks, didn't knew it.