UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 16 Apr 2013 07:19 PM |
Im trying to make a script to do something when a play dies, but I need it to wait longer before respawning them.
If I make CharacterAutoLoads = false and use :LoadCharacter() to respawn them they can no enter the game at all, any ideas? |
|
|
| Report Abuse |
|
|
|
| 16 Apr 2013 07:22 PM |
you could just move their character into lighting while the wait period is going on. then use load character to get them back
|MassiveGman| Scripter & part time Professional Whistler |
|
|
| Report Abuse |
|
|
|
| 16 Apr 2013 07:22 PM |
Add this maybe?:
game.Players.CharacterAutoLoads = false game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) char.Humanoid.Died:connect(function() --ur coad hear end) end) wait(1) -- change to amount of time before play spawns upon entering actual game plr:LoadCharacter() end) |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 16 Apr 2013 07:24 PM |
@Cea No, the problem is if I have auto load off, they are stuck on the "Waiting for character" thing
@Mas I'll try it |
|
|
| Report Abuse |
|
|
|
| 16 Apr 2013 07:25 PM |
| LOL! You call the LoadCharacter method! What's not going to work? |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 16 Apr 2013 07:27 PM |
"Whats not going to work"
Because if I try and load character while they are on that page
It says
"Blah blah server back end" in the output |
|
|
| Report Abuse |
|
|
| |
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 16 Apr 2013 07:29 PM |
@Mas It still loads their character like it would normally
repeat wait(0.03) until Game.Players.LocalPlayer.Character ~= nil
repeat wait(0.03) until Game.Players.LocalPlayer.Character.Humanoid.Health == 0 print("Death") Game.Players.LocalPlayer.Character.Parent = Game.Players.LocalPlayer wait(30) Game.Players.LocalPlayer:LoadCharacter() |
|
|
| Report Abuse |
|
|
|
| 16 Apr 2013 07:30 PM |
Personally, this is what I had done.
After experimenting with the lighting and everything, I found this the simplest.
-When the period of waiting is activated, a forcefield is inserted into the players that I wish to keep out of the game.
-Then, their walkspeed is lowered to 0 -When I wish to bring them back, I remove the forcefield, and give them their walkspeed back.
|MassiveGman| Scripter & part time Professional Whistler |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 16 Apr 2013 07:30 PM |
| Oh and I also tried it with parenting it to Game.Lighting |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 16 Apr 2013 07:31 PM |
@Mas But I want this to work when they die |
|
|
| Report Abuse |
|
|
|
| 16 Apr 2013 07:53 PM |
Yeah, make CharacterAutoLoads false.
Here:
game.Players.PlayerAdded:connect(function(player) repeat wait() until player.Character player.Changed:connect(function(change) if change == "Character" then
-- Do your stuff. wait(12) -- Wait time before spawn. player:LoadCharacter() end end)
end) |
|
|
| Report Abuse |
|
|