You are viewing an archive of Victory Road.
Victory Road closed on January 8, 2018. Thank you for making us a part of your lives since 2006! Please read this thread for details if you missed it.
Made with Lua for Roblox. It will heal a player that touches it.
|
pokemon = "Buizel" --name for one, nil for all function getPokemon() if pokemon ~= nil and hit.Parent:findFirstChild(pokemon) ~= nil then a = true end elseif pokemon == nil then a = true end elseif pokemon ~= nil and hit.Parent:findFirstChild(pokemon) == nil then a = false end end end function onTouched(hit) getPokemon() if a = true then --If player has the "Buizel" Value or if there is no specific pokemon, then something happens hit.Parent.Humanoid.Health = hit.Parent.Humanoid.MaxHealth --Fully Healed elseif a = false then -- If not, then something else happens hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health + 25 end end script.Parent:touched()(function onTouched()):Connect |
That code is pretty close to correct if ProgressBar1 is your health bar and Button1 indicates eating an Oran Berry. A better version would be this:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ProgressBar1.Value >= 80 Then
ProgressBar1.Value = 100
Else
ProgressBar1.Value += 20
End If
End Sub