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: Efficiency to Character:remove()?

Previous Thread :: Next Thread 
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
16 Aug 2014 05:00 AM
Instead of script.Parent.Parent.Parent.Character:remove(), is their a way to make the character wait to spawn?

function onPlayerEntered(newPlayer)
repeat wait() until newPlayer:FindFirstChild("PlayerGui") ~= nil
script.Parent.Parent.Parent.Character:remove()
wait(1)
for i,v in pairs(newPlayer.PlayerGui:GetChildren()) do
v:Remove()
end
local Gui = script.Gui:Clone()
Gui.Parent = newPlayer.PlayerGui
end

Game.Players.ChildAdded:connect(onPlayerEntered)
Report Abuse
breuning is not online. breuning
Joined: 30 Oct 2008
Total Posts: 4268
16 Aug 2014 05:17 AM
http://wiki.roblox.com/index.php?title=API:Class/Players/CharacterAutoLoads
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
16 Aug 2014 05:22 AM
Ahead of you, and i'm stuck. Please state your examples. I've already been trying the wiki.
Report Abuse
breuning is not online. breuning
Joined: 30 Oct 2008
Total Posts: 4268
16 Aug 2014 05:23 AM
local respawnTime = 5

local Players = Game:GetService("Players") Players.CharacterAutoLoads = false

Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) -- find the humanoid, and detect when it dies local Humanoid = Character:FindFirstChild("Humanoid") if Humanoid then Humanoid.Died:connect(function() -- delay, then respawn the character wait(respawnTime) Player:LoadCharacter() end) end end)

Player:LoadCharacter() -- load the character for the first time end)
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
16 Aug 2014 05:24 AM
This is so simple it's not even funny...
Wrote this for you, took like 2 mins

local Players = game:GetService("Players")
Players.CharacterAutoLoads = false
local RespawnTime = 3

Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Character)
Character:WaitForChild("Humanoid").Died:wait()
wait(RespawnTime)
Player:LoadCharacter()
end)
Player:LoadCharacter()
end)

~The herp lerped a derp~
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
16 Aug 2014 05:26 AM
@breuning
There's no need for a connection, it will just take up unnecessary threads

~The herp lerped a derp~
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
16 Aug 2014 05:26 AM
I've already tried this. If you actually read what I said.
Report Abuse
breuning is not online. breuning
Joined: 30 Oct 2008
Total Posts: 4268
16 Aug 2014 05:28 AM
I took the example from the wiki, isn't mine.

People are you using a localscript?
This only works in scripts.
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
16 Aug 2014 05:29 AM
Where do I even put the loading gui? This just makes you spawn. I want it to wait until because I have a script that already loads the character. I just need the character to wait with the loading gui.
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
16 Aug 2014 05:30 AM
I'm using a script.
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
16 Aug 2014 05:30 AM
For some weird reason you still say you are stuck. Above you have 2 perfectly working scripts that do exactly what you asked for, a wait time before the character respawns. If you want it to do something else, say it. We can't read your mind.

~The herp lerped a derp~
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
16 Aug 2014 05:31 AM
repeat wait(1/30) until Player.PlayerGui:FindFirstChild("loading gui name")

~The herp lerped a derp~
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
16 Aug 2014 05:33 AM
local Players = game:GetService("Players")
Players.CharacterAutoLoads = false

Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Character)
local Gui = script.Gui:Clone()
Gui.Parent = Player.PlayerGui
Character:WaitForChild("Humanoid").Died:wait()
end)
end)

???
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
16 Aug 2014 05:36 AM
I'm so sorry. I had the script disabled by accident. Very sorry about that.
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