Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- DO NOT EDIT, YOU MAY EDIT "Settings" Module script.
- --]]
- local Tycoons = {}
- local Teams = game:GetService('Teams')
- local Settings = require(script.ParentSettings)
- local BC = BrickColor
- local Storage = Instance.new('Folder',game.ReplicatedStorage)
- Storage.Name = "PlayerMoney"
- Instance.new('Model',workspace).name = "PartStorage" --Parts dropped go here!
- function returnColorTaken(color)
- for i,v in pairs(Teams:GetChildren()) do
- if v:IsA('Team') then
- if v.TeamColor == color then
- return true
- end
- end
- end
- return false
- end
- if not Settings('AutoAssignTeam') then
- local teamHire = Instance.new('Team', Teams)
- teamHire.TeamColor = BC.new('White')
- teamHire.Name = "For Hire!"
- end
- for i,v in pairs(script.Parent:WaitForChild("Tycoons"):GetChildren())do
- Tycoons[v.Name] = v.Clone()
- if returnColorTaken(v.TeamColor) then
- local newColor;
- repeat
- wait()
- newColor = BC.Random()
- until returnColorTaken(newColor) == false
- v.TeamColor.Value = newColor
- end
- local NewTeam = Instance.new('Team',Teams)
- NewTeam.Name = v.Name
- NewTeam.TeamColor = v.TeamColor.Value
- if not Settings['AutoAssignTeams'] then
- NewTeam.AutoAssignable = false
- end
- v.PurchaseHandler.Disabled = false
- end
- function getPlrTycoon(Player)
- for i,v in pairs(script.Parent.Tycoons:GetChildren()) do
- if v:IsA("Model") then
- if v.Owner.Value == Player then
- return v
- end
- end
- end
- return nil
- end
- game.Players.Added:connect(function(player)
- local plrStats = Instance.new("NumberValue",game.ReplicatedStorage.PlayerMoney)
- plrStats.Name = player.name
- local isOwner = Instance.new("ObjectValue",plrStats)
- isOwner.Name = "OwnsTycoon"
- end)
- game.Players.PlayerRemoveing:connect(function(player)
- local plrStats = game.ReplicatedStorage.PlayerMoney:FindFirstChild(player.Name)
- if plrStats ~=nil then
- plrStats:Destroy()
- end
- local tycoon = getPlrTycoon(player)
- if tycoon then
- local backup = Tycoons(tycoon.Name):Clone()
- tycoon:Destroy()
- wait()
- backup.Parent = script.Parent.Tycoons
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement