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 <string>, 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)
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 (),