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

Can Someone Fix This for Me?

Asked by
Fekz 0
8 years ago

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. :)

0
put the code in a code block 1waffle1 2908 — 8y

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

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
Ad

Answer this question