Dex1337
|
  |
| Joined: 01 Aug 2012 |
| Total Posts: 185 |
|
|
| 09 Aug 2012 10:46 AM |
function waitForChild(instance, name) while not instance:FindFirstChild(name) do instance.ChildAdded:wait() end end
waitForChild(game, "Workspace") waitForChild(game.Workspace, "BuildingPlates") waitForChild(game, "Players")
local activeParts if(game.Workspace:FindFirstChild("ActiveParts")==nil) then activeParts = Instance.new("Model") activeParts.Name = "ActiveParts" activeParts.Parent = game.Workspace else activeParts = game.Workspace.ActiveParts end
local buildingPlates = game.Workspace.BuildingPlates
local assigning = false
function addPlayer(player)
print("addPlayer()", "waiting for previous addPlayer...")
while(assigning) do assigning.Changed:wait() end
assigning = true
print("addPlayer()", "waiting for playerNumber...") waitForChild(player, "playerNumber") print("addPlayer()", "assigning...")
if(player.playerNumber.Value == 0) then print("addPlayer() playerNumber:", player.playerNumber, "stamperTool name:", player.Backpack.StamperTool.Name, "Removing stamperTool.") else
if(activeParts:FindFirstChild(player.Name .. "'s parts")==nil) then local model = Instance.new("Model") model.Name = Player.Name .. "'s parts" model.Parent = activeParts end
print("assignPlate() playerNumber not zero:", player.playerNumber.Value) waitForChild(buildingPlates, "Plate"..tostring(player.playerNumber.Value))
targetPlate = buildingPlates:FindFirstChild("Plate"..tostring(player.playerNumber.Value))
if(targetPlate:FindFirstChild("Player") == nil) then local _player = Instance.new("StringValue") _player.Name = "Player" _player.Parent = targetPlate end targetPlate.Player.Value = player.Name
print("assignPlate()", "complete.", targetPlate.Name, "belongs to", player.Name) end assigning = false end
function removePlayer(player) waitForChild(game.Workspace, "ActiveParts") waitForChild(game.Workspace.ActiveParts, player.Name .. "'s parts") local model = game.Workspace.ActiveParts:FindFirstChild(player.Name .. "'s parts") model:remove()
local takenPlates = buildingPlates:GetChildren() for i = 1, #takenPlates do if takenPlates[i].Player.Value == player.Name then takenPlates[i].Player.Value = "" end end
end
local players = game.Players:GetChildren() for i = 1, #players do addPlayer(players[i]) end
game.Players.PlayerAdded:connect(function(player) addPlayer(player) end)
game.Players.PlayerRemoving:connect(function(player) removePlayer(player) end)
|
|
|
| Report Abuse |
|
|
| 09 Aug 2012 10:47 AM |
| It no work cuz it free model, :3. |
|
|
| Report Abuse |
|
|
| 09 Aug 2012 10:53 AM |
^^^^^^ Also, this script is ugly. |
|
|
| Report Abuse |
|