Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script.Parent.Owner.Changed:Connect(function(value)
- if value ~= nil then
- for _, item in pairs(game.ServerStorage.WXBZTSave:FindFirstChild("wxbztycoon-" .. value.UserId):GetChildren()) do
- if item.Value then
- game.ServerStorage.TycoonsPurchasesBackup.Purchases:FindFirstChild(item.Name):Clone().Parent = script.Parent.PurchasedObjects
- for _, btn in pairs(script.Parent.Buttons:GetChildren()) do
- if btn.Object.Value == item.Name then
- btn:Destroy()
- break
- end
- end
- end
- end
- script.Parent.Buttons.ChildAdded:Connect(function(btn)
- if game.ServerStorage.WXBZTSave:FindFirstChild("wxbztycoon-" .. value.UserId)[btn.Object.Value].Value then
- btn:Destroy()
- end
- end)
- script.Parent.PurchasedObjects.ChildAdded:Connect(function(obj)
- game.ServerStorage.WXBZTSave:FindFirstChild("wxbztycoon-" .. value.UserId)[obj.Name].Value = true
- end)
- script.Parent.PurchasedObjects.ChildRemoved:Connect(function(obj)
- game.ServerStorage.WXBZTSave:FindFirstChild("wxbztycoon-" .. value.UserId)[obj.Name].Value = false
- end)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement