How can I make
1 | local SCP 049 = script.Parent; |
2 | local clone = SCP 049 :Clone() |
3 | SCP 049. Humanoid.Died:connect( function () |
4 | wait( 5 ) |
5 | SCP 049 :Destroy() |
6 | clone.Parent = Workspace |
7 | end ) |
repeat when its done without making roblox crash?
When the initial Humanoid dies -that's it. The event never fires again. You have to attach a new function to the new humanoid.
However, you can't make infinitely complex code, so you can't use an anonymous function here:
01 | local SCP 049 = script.Parent; |
02 | local clone = SCP 049 :Clone() |
03 |
04 | function respawn() |
05 | wait( 5 ) |
06 | SCP 049 :Destroy() |
07 | SCP 049 = clone:Clone() |
08 | SCP 049. Parent = workspace |
09 |
10 | SCP 049. Humanoid.Died:connect(respawn) |
11 | end |
12 |
13 | SCP 049. Humanoid.Died:connect(respawn) |
Simple, use a
1 | while true do |
2 |
3 | end |
Just put that script in there and put a wait somewhere in there like this
1 | while true do |
2 | wait( 1 ) |
3 |
4 | end |
so it doesn't keep repeating every like 0.1 of a second. It would lag out and crash your server!
If you have any questions feel free to ask : )
Locked by youtubemasterWOW
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?