Only plays once?
I made a script that has a GUI animation when my fake health integer <= 0
It works once, perfectly then when the value reaches 0 again, it doesn't even make the GUI visible.
Anyone know why?
01 | local World = script.Parent.Parent.Parent.InWorld |
02 | local DeathMessages = { |
05 | , "HAHAHAHAHAH! YOU DIED!" |
08 | , "Try to stay alive this time? Kthx." |
09 | , "Y'know... Irl... YOLO!" |
10 | , "Your so good at this game." |
11 | , "You did it! YOU DIED!" |
12 | , "Don't look into the light!" |
18 | , "You died? lolno rly?" |
19 | , "You died? YOUR NOT JOKING?" |
22 | , "RAAAAAAAAAAAAAAAAAAAAAGE!!!!" |
23 | , "You Only Live Once, you let it go to waste." |
25 | , "TROLOLOLOLO!!!!!!!!!" |
27 | , "If you don't succeed, try, try again." |
32 | if script.Parent.Parent.Health.Value < = 0 then |
33 | local RndMsg = DeathMessages [ math.random( 1 ,#DeathMessages) ] |
34 | script.Parent.Fail.Text = RndMsg |
35 | script.Parent.Visible = true |
36 | script.Parent.Fail.Position = UDim 2. new(- 1 , 0 , 0.5 , 0 ) |
37 | script.Parent.GameOver.Position = UDim 2. new( 0.5 , 0 ,- 1 , 0 ) |
39 | script.Parent.GameOver:TweenPosition(UDim 2. new( 0.5 , 0 , 0.425 , 0 ), "Out" , "Quad" , 4 ) |
40 | script.Parent.Fail:TweenPosition(UDim 2. new( 0.5 , 0 , 0.5 , 0 ), "Out" , "Quad" , 3.25 ) |
46 | script.Parent.GameOver.Rotation = script.Parent.GameOver.Rotation - 1 |
49 | script.Parent.GameOver.Rotation = script.Parent.GameOver.Rotation + 1 |
55 | script.Parent.GameOver.Rotation = (script.Parent.GameOver.Rotation + 1 ) |
58 | script.Parent.GameOver:TweenPosition(UDim 2. new( 0.5 , 0 , 1.1 , 0 ), "Out" , "Quad" , 1.5 ) |
60 | script.Parent.Visible = false |
61 | script.Parent.GameOver.Rotation = 0 |
62 | if script.Parent.Parent.Health.Value < = 0 then |
63 | game.Players.LocalPlayer.Character.Torso.CFrame = CFrame.new(game.Workspace [ World.Value ] .SpawnPoint.Position + Vector 3. new( 0 , 3 , 0 )) |
64 | script.Parent.Parent.Health.Value = script.Parent.Parent.MaxHealth.Value |