RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a script that plays a sound when a player gets health goes down"
-- local script (inside StarterPlayerScripts) local Players = game:GetService("Players") local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local sound = Instance.new("Sound") sound.SoundId = "rbxassetid://your_sound_id_here" sound.Parent = character local function onHealthChanged() if humanoid.Health < humanoid.MaxHealth then sound:Play() end end humanoid:GetPropertyChangedSignal("Health"):Connect(onHealthChanged)