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

A script I made works in studio, but not the actual game, why?

I "made" a simple code to help music transition into different areas in my ROBLOX game.

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
	game.Players[hit.Parent.Name].PlayerGui.Sound1:Play()
	game.Players[hit.Parent.Name].PlayerGui.Sound2:Stop()
end
end)

(The script is a normal Script object, and I tried using LocalScript)

and it works... sort of. When I walk through, it plays a nice song, and when I walk through it plays a different song, it works only in studio and not the actual game. I don't know if its a coding problem, or a script problem (I'm new to this stuff). Any help to this would be greatly appreciated!

2 comments

0

What's the output say online? Do you have FilteringEnabled on?

0

Yes, I do have filtering enabled, and the output says nothing.

1 answer

This might be caused because you are using a local script inside the part.

If that s the issue, then it works on Studio because when you press the play button, everything is ran locally, and not on the server. Change it to a server script and it will work perfectly fine.

2 comments

0

He said he's not

0

Yeah, Im not.

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