local children = game.Workspace.sikshit:GetChildren()
local song = game.Workspace.Sound
while wait() do
for i, v in pairs(children) do
v.Size = Vector3.new(0.23,2.15,song.PlaybackLoudness/30)
end
end
COMMUNITY QUESTION
Try to make script execute after a Sound has been added to workspace?
1 answer
To detect when an object has been added to the workspace, we can use the ChildAdded event of Workspace. In your context, it can be used like so:
local children = game.Workspace.sikshit:GetChildren()
local song = game.Workspace.Sound
workspace.ChildAdded:Connect(function(Child)
if Child:IsA("Sound") then
song = Child
end
end)
while wait() do
for i, v in pairs(children) do
v.Size = Vector3.new(0.23,2.15,song.PlaybackLoudness/30)
end
end
Please note I wrote this in the ScriptingHelper's textbox, so excuse any minor errors.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Add context. What are you trying to do.
So this script changes bricks in a model name "sikshit" to resize to the music and it used to work with a music player but now i want it to work with admin commands when music is played with a command :music xxxxxxxxxx