Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i detect when a sound's soundid is changed?

Asked by 5 years ago

how do i detect when a sound's soundid is changed? ive tried looking for a while but couldent find anything that worked this is one of the things ive tried: https://devforum.roblox.com/t/new-api-instance-getpropertychangedsignal/36212 and help will be apretiated

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

You almost got it in that DevForum post. All you have to do is add is make a .Changed function, add a property variable, and check if that variable is SoundId!

Example Code of a Part inside Workspace with a Sound object:

game:GetService("Workspace").Part.Sound.Changed:Connect(function(property)
    -- The property variable is what was changed
    if property == "SoundId" then
        print("SoundId has changed!")
        -- Put your code here
    end
end)

If this helped please accept this answer!

0
workspace is a global variable...no need to make it fancy Vulkarin 581 — 5y
0
I like do to getservice i think its cleaner cause you have to use getservice on other things so Warfaresh0t 414 — 5y
0
You can also use GetPropertyChangedSignal to shorten the code a bit. This way there would be no need for the if statement. lunatic5 409 — 5y
Ad

Answer this question