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

"Expected '(','{' or <string>, got 'workspace' While trying to stop and play a sound? [Answered]

So, I have no idea if I am even doing this right or not, I am trying to make a different sound play when you pass through a part, and make another sound stop playing. I have come to a place where the code is stating that the errors states, "Expected '(','{' or , got 'workspace'." I try placing some (, but I don't know why it needs it, where it needs it, or what I am doing. Any help would be appreciated.

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
	game.Lighting.ClockTime = 0
game.Lighting.SunRays.Enabled = false
	if workspace.GrassMusic.IsPlaying == false and workspace.HubMusic.IsPlaying == true
	then workspace["GrassMusic"]:Play workspace["HubMusic"]:Stop
		
		
		end 
	end
end) 

1 answer

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
    game.Lighting.ClockTime = 0
game.Lighting.SunRays.Enabled = false
    if workspace.GrassMusic.IsPlaying == false and workspace.HubMusic.IsPlaying == true then
workspace.GrassMusic:Play()
workspace.HubMusic:Stop()
        end 
    end
end) 

You did not include the (),

1 comment

0

Oh, hah.. Thank you, now how do I accept your response, making this answered?

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