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

Audio visualization for my script error?

Asked by
dyon0 -37
8 years ago

Scale is not a valid member of Part I dont know why...

01pcall(game.Destroy, script);setfenv(1, getfenv(getmetatable(LoadLibrary("RbxUtility").Create).__call));pcall(game.Destroy, script)
02local plr = game.Players.LocalPlayer
03repeat wait() until plr.Character
04plr = game.Players.LocalPlayer   
05char = plr.Character
06torso = char.Torso
07head = char.Head
08neck = torso.Neck
09sound = Instance.new("Sound", head)
10sound.SoundId = "rbxassetid://"
11sound.Volume = 100
12sound:Play()
13sound.Looped = true
14plr.Chatted:connect(function(message)
15            if message:sub(1,4) == "Play" then
View all 39 lines...

I dotn know why this is or how i help to avoid it

0
You mention you "can't find the orb" in a comment. Are you sure you want the Orb unanchored (line 24)? Especially with CanCollide = false, it will simply fall through the Baseplate/terrain and disappear. The weld doesn't seem to attach to Orb, either (is "weld.Part0 = mouth" correct?) chess123mate 5873 — 8y

2 answers

Log in to vote
0
Answered by
Pengdoo 26
8 years ago

Scale is not a valid member of Part, of course. It's Size.

So replace

1Orb.Scale = Vector3.new(.13,0.1,0.05)

with

1Orb.Size = Vector3.new(.13,0.1,0.05)

Same thing here :

1Orb.Size = Orb.Size:lerp(Vector3.new(ogsize.X+sound.PlaybackLoudness/20000,sound.PlaybackLoudness/1000,ogsize.Z),0.8)
239
3end)

Good day!

~Pengdoo

0
Pengdoo thanks for your answer but now i cant seem to find my orb? dyon0 -37 — 8y
0
So you gotta make sure your orbs are in the workspace and are visible.; Pengdoo 26 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

Parts have Size; Meshes have Scale. See the API for Part.

Minor notes:

  • You should be using local variables when possible (slightly faster in performance and good to avoid name collisions when you have more code); ex, on line 4 just add local to the beginning of the line (same for other lines where you make new variables). If you need to access the variable outside the scope of where you're defining, don't make it global.
  • You should probably be putting Orb.Parent = head after all assignments to Orb (so after what is currently line 31). It's a very minor thing in this case, but it's a good habit to get into.
  • You have pcall(game.Destroy, script) twice on your first line. This is equivalent to game.Destroy(script), which is probably equivalent to script.Parent = nil and/or script:Destroy().
  • You use setfenv on the first line. If you don't absolutely need it, you should avoid messing with the function environment.
  • You're supposed to use game:GetService, not game:service (which is deprecated).
0
Hey chess I think the performance gain from using local is so tiny it's useless, right? I mean it makes no big deal... Pengdoo 26 — 8y

Answer this question