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

Can Someone Fix This for Me?

I have this in my GameScript, and I have almost absolutely no idea what to do.

local sound = game.Workspace.MusicBlock1.Sound local MB1 = game.Workspace.MusicBlock1 local playcall = game.Workspace.MusicBlock1.Sound.IsPlaying

function onTouch(MB1) MB1.sound.playcall = true end

MB1.Touched:connect(onTouch)

As you can see, I want to make my sound play once someone touches the MusicBlock, but it's not performing correctly, saying that there is an error on line 7 (MBI.sound.playcall = true), and that "sound" isn't a valid member of "Part", or "MB1".

Help, please. :)

1 comment

0

put the code in a code block

1 answer

You're trying to index variables you made in another object as though that object has those properties. It doesn't, though.

MB1.sound.playcall = true

should be

MB1.Sound.IsPlaying = true

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