|
| 06 Aug 2014 09:06 PM |
backstory - when you have .3% of your health a music plays else music stops
problem - output says 'attempt to index local 'E' (a nil value)'
local P = game.Players.LocalPlayer local E = P.Character
E.Humanoid.HealthChanged:connect(function() if E then if E.Humanoid.Health <= E.Humanoid.MaxHealth * .3 then E.Humanoid.WalkSpeed = 11 script.Cliff:Play() elseif E.Humanoid.Health > E.Humanoid.MaxHealth * .3 then E.Humanoid.WalkSpeed = 16 script.Cliff:Stop() end end end)
|
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 06 Aug 2014 09:11 PM |
local P = game.Players.LocalPlayer local E = P.Character repeat wait() until E
E.Humanoid.HealthChanged:connect(function(h) if h <= E.Humanoid.MaxHealth * .3 then E.Humanoid.WalkSpeed = 11 script.Cliff:Play() elseif h > E.Humanoid.MaxHealth * .3 then E.Humanoid.WalkSpeed = 16 script.Cliff:Stop() end end)
|
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 09:21 PM |
it works in studios but not online qqq |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 06 Aug 2014 09:22 PM |
Add this to the top repeat wait() until game.Players.LocalPlayer |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 09:22 PM |
LocalPlayer only works in a LocalScript in the StarterPack or StarterGui or anything inside the Player.
In solo it would work in a normal script but for it to work in the expected online mode, put it in a localscript. |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 09:23 PM |
wow infocus rly bro y u no no. u has to do dis
local P = game.Players.LocalPlayer repeat wait() until P.Character local E = P. Character |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 09:23 PM |
local P = game.Players.LocalPlayer repeat wait() until P local E = Workspace:WaitForChild(P.Name)
E.Humanoid.HealthChanged:connect(function() if E then if E.Humanoid.Health <= E.Humanoid.MaxHealth * .3 then E.Humanoid.WalkSpeed = 11 script.Cliff:Play() elseif E.Humanoid.Health > E.Humanoid.MaxHealth * .3 then E.Humanoid.WalkSpeed = 16 script.Cliff:Stop() end end end) |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 06 Aug 2014 09:23 PM |
Already did @drag
Look at first post.
Gg no re |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 09:29 PM |
@SenseiWarrior @Infocus thanks for help
@DeSpizer27 i know |
|
|
| Report Abuse |
|
|