JoeRaptor
|
  |
| Joined: 08 Sep 2012 |
| Total Posts: 282 |
|
|
| 09 Jan 2017 10:14 PM |
I want to stretch the respawn time to 15 seconds but my loading screen, by which fades into view, crashes on me!Like an infinite loading loop!!! I need help! Right now!
Here is the script!
fade = script.Parent fadeGoal = 0 fadeRate = 0.01
function updateFade() local current = fade.BackgroundTransparency if current < fadeGoal then fade.BackgroundTransparency = math.min(fadeGoal,current+fadeRate) elseif current > fadeGoal then fade.BackgroundTransparency = math.max(fadeGoal,current-fadeRate) else fade.BackgroundTransparency = fadeGoal end end
player = game.Players.LocalPlayer character = player.Character or player.CharacterAdded:wait() humanoid = player.Character:WaitForChild("Humanoid") rs = game:GetService("RunService")
fadeGoal = 1
humanoid.Died:connect(function () wait(1) fadeGoal = 0 player.CharacterAdded:wait() fadeGoal = 1 end)
rs.RenderStepped:connect(updateFade)
fade.Visible = true
[This is the respawn script from the Roblox Cookbook] <----- It does it's job but my loading screen crashes into an infinite loop.
| | | V
local respawnDelay = 15 game.Players.CharacterAutoLoads = false game.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() wait(respawnDelay) player:LoadCharacter() end) end end) player:LoadCharacter() -- load the character for the first time end) |
|
|
| Report Abuse |
|
|
Laedere
|
  |
| Joined: 17 Jun 2013 |
| Total Posts: 23601 |
|
|
| 09 Jan 2017 10:15 PM |
| it crashes because it loads the character, calling the characteradded event, which in turn, loads the character again |
|
|
| Report Abuse |
|
|
JoeRaptor
|
  |
| Joined: 08 Sep 2012 |
| Total Posts: 282 |
|
|
| 09 Jan 2017 10:41 PM |
| Nice name, I like the latin, anyway what would rid my problem so I can extend the respawn time? |
|
|
| Report Abuse |
|
|
JoeRaptor
|
  |
| Joined: 08 Sep 2012 |
| Total Posts: 282 |
|
| |
|
JoeRaptor
|
  |
| Joined: 08 Sep 2012 |
| Total Posts: 282 |
|
| |
|