Hi guys so how do I stop the sound after I click when my health is 0?
Asked by
2 years ago Edited 2 years ago
Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).
ok it now says expected then when parsing if statement got '='
here code:
`local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local humanoid = player.character.humanoid
if humanoid.health = 0 then
stopsound()
else if humanoid.health < 0 then
stopsound()
end
end
function playsound()
1 | sound = Instance.new( "Sound" ) |
2 | sound.Parent = player.Character |
end
local function stopsound()
mouse.Button1Down:Connect(playsound)
mouse.Button1Up:Connect(stopsound)
humanoid.health.changed:connect(function()
end)
function playsound()
1 | sound = Instance.new( "Sound" ) |
2 | sound.Parent = player.Character |
end
local function stopsound()
mouse.Button1Down:Connect(playsound)
mouse.Button1Up:Connect(stopsound)
humanoid.health.changed:connect(function()
end)`