Hello, I'm just wondering why this script won't work (A local script inside starterGui) there is no ouput by the way.
Please support me with any solutions, thanks.
local Plr = game.Players.LocalPlayer
local Char = Plr.Character
if not Char or not Char.Parent then
Char = Plr.CharacterAdded:wait()
end
function PlaySound()
local Sounds = {"1470936712", "1470937053", "1470937969"}
wait()
if Char.Humanoid.Health < 100 then
local Sound = Instance.new('Sound')
Sound.SoundId = math.random[#Sounds]
Sound.Parent = Char:WaitForChild('Head')
Sound:Play()
wait(Sound.TimeLength)
Sound:Destroy()
end
end
while true do
while Char.Humanoid.Health < Char.Humanoid.MaxHealth do
PlaySound()
end
Char.Humanoid.HealthChanged:Wait()
end

1 comment
i think you need the rbxassetid:// prefix in the SoundId. You also need to put Sounds[math.random(#Sounds)] on line 12.