i tried this
function onClicked(playerWhoClicked) local message = Instance.new('Message', game.Workspace) message.Text = "Self Destruction Activated!" wait(5) message:Destroy() play(game.Workspace.Sound) end script.Parent.ClickDetector.MouseClick:connect(onClicked)
and sound:Play.game.workspace.sound
function onClicked(playerWhoClicked) local message = Instance.new('Message', game.Workspace) local Sound = game.Workspace:WaitForChild('Sound') message.Text = "Self Destruction Activated!" wait(5) message:Destroy() Sound:Play() --Use :Play() to play sounds, also try using :WaitForChild() in case the sound hasnt loaded yet. end script.Parent.ClickDetector.MouseClick:connect(onClicked)
To play the sound, you got to state the sound first then bind it with the Play function. E.g: Just like you did with message:Destroy()
All I did is fixed line 6:
function onClicked(playerWhoClicked) local message = Instance.new('Message', game.Workspace) message.Text = "Self Destruction Activated!" wait(5) message:Destroy() workspace.Sound:Play() --Make sure you spell 'Sound' or 'sound' correctly end script.Parent.ClickDetector.MouseClick:connect(onClicked)