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 » Scripters
Home Search
 

Re: onplayerleave

Previous Thread :: Next Thread 
Zakusa is not online. Zakusa
Joined: 16 Feb 2013
Total Posts: 359
17 Sep 2015 08:35 PM
hi i need help with getting localplayer in a script ( not local script ) like theres a model in lighting called "Zakusa's buildings" or anyones name and i want it so when you leave it removes zakusa's buildings ( or anyones name ) from lighting
Report Abuse
uglypoe is not online. uglypoe
Joined: 26 Mar 2011
Total Posts: 4382
17 Sep 2015 08:36 PM
game.Players.PlayerRemoving:connect(function(plr)
game.Lighting:FindFirstChild(plr.Name.."'s buildings"):remove()
end)
Report Abuse
Zakusa is not online. Zakusa
Joined: 16 Feb 2013
Total Posts: 359
17 Sep 2015 08:48 PM
ya ok so i put the script in workspace and it didnt work i edited it a bit and its still not working but found a mistake

your script:
game.Players.PlayerRemoving:connect(function(plr)
game.Lighting:FindFirstChild(plr.Name.."'s buildings"):remove()
end)

before plr.name there should be "".. i think and ya it looks correct to me i dont know why its not working
Report Abuse
DeathsLASTwords is not online. DeathsLASTwords
Joined: 28 Jan 2012
Total Posts: 2701
17 Sep 2015 08:49 PM
Pro tip, dont listen to uglypoe, hes an actual idiot and still used the deprecated :remove(). Throw his advice out the window


(This is my signature): Im extremely sarcastic, but most of the time I will provide useful info for you! :)
Report Abuse
Zakusa is not online. Zakusa
Joined: 16 Feb 2013
Total Posts: 359
17 Sep 2015 08:51 PM
what but i always use :remove() then removing something
Report Abuse
DeathsLASTwords is not online. DeathsLASTwords
Joined: 28 Jan 2012
Total Posts: 2701
17 Sep 2015 08:52 PM
:remove() is deprecated(isnt practical anymore)

use :Destroy()


(This is my signature): Im extremely sarcastic, but most of the time I will provide useful info for you! :)
Report Abuse
foreverpower is not online. foreverpower
Joined: 05 Feb 2011
Total Posts: 5578
17 Sep 2015 08:54 PM
You should never use :remove or :Remove when removing something.

:Destroy locks an instance's parent to nil and disconnects all events, freeing any memory in use by the computer associated with those events.

Instance.Parent = nil is the same thing as Instance:Remove, and should be used when you want to get an Instance back after it has been removed.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
17 Sep 2015 08:55 PM
Sort of, you can't necessarily get the instance back
Report Abuse
Zakusa is not online. Zakusa
Joined: 16 Feb 2013
Total Posts: 359
17 Sep 2015 08:56 PM
ya i tried this

game.Players.PlayerRemoving:connect(function(plr)
game.Lighting:FindFirstChild(""..plr.Name.."'s buildings"):Destroy()
end)

but it didnt work
Report Abuse
foreverpower is not online. foreverpower
Joined: 05 Feb 2011
Total Posts: 5578
17 Sep 2015 09:00 PM
@cntkillme
See my post.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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