local Humanoid = game.Players.LocalPlayer.Character.Humanoid.Health
Make sure to add an intvalue and rename it to "recentUserHP" Make sure it's parented to script1
local script1 = script.Parent -- Defining the function local frame = script1.Frame local sound = Instance.new ("Sound",script1) sound.SoundId = "http://www.roblox.com/asset/?id=386232234" local humanoid = game.Players.LocalPlayer.Character.Humanoid --this function below fires whenever the humanoid's health changes. --It also gets the health of the user at that time. (inside the parentheses) humanoid.HealthChanged:connect(function(health) if script1.recentUserHP.Value > health then --this asks if the most recent HP logged is higher than the users current HP sound:Play() elseif script1.recentUserHP.Value < health then end end)
Closed as Not Constructive by PrismaticFruits, ScuffedAI, JesseSong, and SoftlockedUnderZero
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?