labr_nth
(artificial money)
August 2, 2022, 5:11am
#1
Hello developers, quick question here:
How do I kill the player and destroy the sound once the sound is fully finished/ over?
Here’s the code (without humanoid.health = 0):
local sound = Instance.new("Sound") sound.Parent = workspace.PARALOL.Torso sound.SoundId = "rbxassetid://10419979590" sound:Play() sound.Ended:Wait() sound:Destroy()
Thanks, -Para
labr_nth
(artificial money)
August 2, 2022, 5:14am
#2
(I am aware this is very simple code, but I am mostly a builder, and I have no one helping me with this game right now, so I resorted to this.)
J3rry15
(Jerry)
August 2, 2022, 5:20am
#3
Try doing
local Sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://10419979590"
sound:Play()
sound.Ended:Wait()
sound:Destroy()
workspace.PARALOL.humanoid:TakeDamage(math.huge)
--Or
workspace.PARALOL.PrimaryPart:Destroy()
1 Like
instead of doing sound:Destroy() you could do sound:Stop()
I think its killing the player because the sound is a parent of the tor
labr_nth
(artificial money)
August 2, 2022, 5:21am
#5
I’m using Sound:Destroy to clear debris or unnecessary audios inside the game. The game is pretty heavy on graphics so adding more unused audios can lag (according to my friend).
1 Like