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()
sound = Instance.new("Sound") sound.Parent = player.Character sound.SoundId = "rbxassetid://9815509707" sound:Play()
end
local function stopsound()
sound:Stop() sound:Destroy() end
mouse.Button1Down:Connect(playsound)
mouse.Button1Up:Connect(stopsound) humanoid.health.changed:connect(function() end)
function playsound()
sound = Instance.new("Sound") sound.Parent = player.Character sound.SoundId = "rbxassetid://9815509707" sound:Play()
end
local function stopsound()
sound:Stop() sound:Destroy() end
mouse.Button1Down:Connect(playsound)
mouse.Button1Up:Connect(stopsound) humanoid.health.changed:connect(function() end)`
Well it looks like you never defined Humanoid
... (so do it)
add these lines
local humanoid = player.character.humanoid humanoid.health.changed:connect(function() if humanoid.health = 0 then stopsound() else if humanoid.health < 0 then stopsound() end) end)
You have to put "==" instead of "=" in the line with the if and else if statements, also you dont need two statements i think
So it would be this
if humanoid.health <= 0 then stopsound() end