|
| 01 Jun 2015 07:32 PM |
This is what I've got so far. It doesn't work, and I'm not sure why:
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") local lvl = part.Parent.leaderstats.Lvl if h~=nil then h.MaxHealth = h.MaxHealth + (lvl * 10) - 10 end end
script.Parent.Touched:connect(onTouched)
~MightyDantheman |
|
|
| Report Abuse |
|
|
|
| 01 Jun 2015 07:35 PM |
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local humanoid = hit.Parent:FindFirstChild("Humanoid") local player = game.Players:GetPlayerFromCharacter(hit.Parent) local lvl = player.leaderstats.Lvl h.MaxHealth = h.MaxHealth + (Lvl * 10) - 10 h.Health = h.MaxHealth end end) |
|
|
| Report Abuse |
|
|
|
| 01 Jun 2015 07:41 PM |
It doesn't seem to work for me. I tried it that way and changed it to this and it still didn't work:
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local humanoid = hit.Parent:FindFirstChild("Humanoid") local player = game.Players:GetPlayerFromCharacter(hit.Parent) local lvl = player.leaderstats.Lvl humanoid.MaxHealth = humanoid.MaxHealth + (lvl * 10) - 10 humanoid.Health = humanoid.MaxHealth end end) |
|
|
| Report Abuse |
|
|
|
| 01 Jun 2015 07:47 PM |
This script is inside a spawner btw. I don't think it would matter, but that's where it is.
~MightyDantheman |
|
|
| Report Abuse |
|
|
|
| 01 Jun 2015 07:49 PM |
Also, should I use a local script instead of the regular one?
~MightyDantheman |
|
|
| Report Abuse |
|
|
|
| 01 Jun 2015 08:11 PM |
I still need help?
~MightyDantheman |
|
|
| Report Abuse |
|
|
|
| 01 Jun 2015 08:27 PM |
Please help.
~MightyDantheman |
|
|
| Report Abuse |
|
|
|
| 01 Jun 2015 08:43 PM |
"(lvl * 10)" ye forgot the .Value for lvl |
|
|
| Report Abuse |
|
|
|
| 01 Jun 2015 10:58 PM |
Thank you!
~MightyDantheman |
|
|
| Report Abuse |
|
|