Goal:
I want to get the Obby map change it’s parent when a player that owns the map leaves, but things go wrong and here’s what I’ve got.
Script:
Players.PlayerRemoving:Connect(function(plr)
local Obby = plr:WaitForChild("stats").Obby
local Challenge = plr:WaitForChild("stats").Challenge
print("asdasd")
if not workspace.Obbies:FindFirstChild(Obby) then
workspace.Obbies:FindFirstChild(ObbyOwned(plr)).Parent = ServerStorage.Obbies
end
end)
More information:
The script is server-sided, the ObbyOwned()
script is:
local function ObbyOwned (player)
return player:WaitForChild("stats").Obby.Value
end
Hopefully the function itself is fine, but when I did use Obby variable instead of that function, it would give the same error. Obby
variable also stores the map’s name, I know there could be more ways to get that, but it’s the easiest and most efficient one i’ve got.
Thanks!