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

so we've got a problem hueston?????

So this works perfectly in studio, but doesn't work in game. Pretty much it scales the part according to the music/sound. Also, It says nothing in Output.

Sound = game.Workspace.Sounds.Sound1

while true do
	wait(0.001)
	script.Parent.Scale = Vector3.new(script.Parent.Scale.X, Sound.PlaybackLoudness / 150, script.Parent.Scale.Z)
end

2 comments

0

it works in studio perfectly, but not in game.

0

You might want to lower that wait a little

1 answer

Hi!

In the real game, things take much longer to load than in test server. When you set the variable, the workspace object may not be there in the actual game yet. It's best you add a waiting loop until the Sounds actually exists before you begin the script.

P.S. The default minimum tick for wait is roughly .03 seconds. Any number set to lower will automatically put it to that. It's better you just use wait() instead of wait(0.001).

repeat wait() until workspace.Sounds.Sound1
Sound = workspace.Sounds.Sound1

while true do
    wait()
    script.Parent.Scale = Vector3.new(script.Parent.Scale.X, Sound.PlaybackLoudness / 150, script.Parent.Scale.Z)
end

3 comments

0

Still doesn't work ;-;

0

Haven't you ever heard about WaitForChild?

0

I have ;)

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