i accidentally deleted the first version so im too lazy to explain it all so heres the quicky
so i made a "SoundBrick" and its supposed to play a sound , then check if the player is five times the position (in x y or z) of the brick , if it is then the song should stop . i think i might've messed up on the coding but remember this is my first time using sound and Positions soooo idk
if you have any more questions on what i did or the placement is or something just ask ,-,
brick = script.Parent.Position.position local player = script.Parent.BodyPosition.position function onTouch() script.Sound:Play() wait(40) if brick < player * 5 then script.Sound.Stop() end end script.Parent.Touched:connect(onTouch)
I see multiple things wrong with this.
First of all, what's up with Position.position
? The 'Position' property of a Part is a Vector3, and 'position' isn't a property of a Vector3.
Next thing, you only check the positions one time. Move the variables 'brick' and 'player' into the onTouch function.
Next, replace connect
with Connect
, as connect
is deprecated.