VerdommeMan

just example of what might roblox do behind the scene which fires characteradded

Aug 26th, 2020 (edited)
2,754
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. -- this is not at all whats happening behind the scenes but this is just for the sake of example of you might understand that events just get called after actions
  2.  
  3. local dummy = nil --reference dummby
  4.  
  5. local function createCharacter(player)  
  6.     local newChar = dummy:Clone()  -- basically what loadCharacter() does
  7.     newChar.Name = player.Name
  8.     -- apply description etc
  9.     -- give networkownership etc
  10.     newChar.Parent = workspace
  11.     player.ChararacterAddedEvent:Fire(newChar) -- this is not a real property
  12.     newChar.Humanoid.Died:Connect(function() -- replaces old char with a new char on death, prob how roblox would fire this event isach time the  the humanoid health changes it checks if its zero/ lower if it is then it kills it and calls .Died:Fire(), as you see it never waits
  13.         wait(game.Players.RespawnTime)
  14.         createCharacter(player)
  15.     end)
  16. end
  17.  
  18. game.Players.PlayerAdded(createCharacter) -- calls when player initially joins
  19.  
  20.  
  21. -- as you can see its just actions after actions, this is not real code and will not work
Advertisement
Add Comment
Please, Sign In to add comment