Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I get an audio to play when a player is 50 health or below?

Asked by 10 years ago

really not much to say down here..

2 answers

Log in to vote
1
Answered by 10 years ago
while true do
wait()
local humanoid=script.Parent--In a separate script, have it clone into players

if humanoid then
local plr=humanoid.Parent:GetPlayerFromCharacter()
if humanoid.Health<=50 then
if plr.PlayerGui.Sound.IsPlaying=false then
plr.PlayerGui.Sound:Play()--If you put the sound in PlayerGui, only the player hears it(So I have been told)
end
elseif humanoid.Health>=51 then
if plr.PlayerGui.Sound.IsPlaying=true then
plr.PlayerGui.Sound:Stop()


end
end
end
end

Sorry if this doesn't work. Since you didn't show what you tried, you have to clone the script

Ad
Log in to vote
0
Answered by
KAAK82 16
10 years ago
if Humanoid.Health <= 50 then --I'll Assume u have already defined Humanoid
Sound:Play() --I'll just Assume u have already defined Sound
0
thats just the thing itself, if u dont know wat other stuff to type, tell me KAAK82 16 — 10y
0
I don't.. zachhg03 35 — 10y

Answer this question