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

Why is my script not working?

Asked by 10 years ago

I want it to play music when the scripts parent is touched but it doesn't work can you fix my script?

music = game.Workspace.Music

function onTouch()
    music:Play()
end

script.Parent.Touched(onTouch)

1 answer

Log in to vote
1
Answered by 10 years ago

You forgot the :connect on the connection line, use this:

music = game.Workspace.Music

function onTouch()
    music:Play()
end

script.Parent.Touched:connect(onTouch)
1
Whoops I made a stupid but simple mistake thanks! idontcare2004 5 — 10y
0
It's alright, I make mistakes like that sometimes! General_Scripter 425 — 10y
Ad

Answer this question