Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Trying to find certain objects in the workspace(sound) by using its classname?

Im trying to create a script to look for any objects with the classname Sound in the workspace but idk how to do it i tried using findfirstchild but it only finds using the name, not the classname?

like i can use this but it only finds it using the name of it not classname

local found = workspace:FindFirstChild("Sound",true) if found then found.PlaybackSpeed = 0.5 end

2 answers

There's a function called 'FindFirstChildOfClass'.

local sound = workspace:FindFirstChildOfClass('Sound')

if sound then sound.PlaybackSpeed = 0.5 end

1 comment

0

how can i make it search the whole workspace, like if the sound is on a part or in a folder

There is a property of all instances called GetDescendants. You can use this like so,

for i,v in pairs(workspace:GetDescendants()) do
	if v.ClassName == "Sound" then
		--Do Stuff
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.