generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Why doesnt this work?

Previous Thread :: Next Thread 
Dex1337 is not online. 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
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
09 Aug 2012 10:47 AM
It no work cuz it free model, :3.
Report Abuse
zankonator1 is not online. zankonator1
Joined: 27 Jun 2009
Total Posts: 1758
09 Aug 2012 10:53 AM
^^^^^^
Also, this script is ugly.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image