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

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

Asked by 4 years ago
Edited 4 years ago

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) 

1 answer

Log in to vote
0
Answered by
Raccoonyz 1092 Donator Moderation Voter
4 years ago
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 (),

0
Oh, hah.. Thank you, now how do I accept your response, making this answered? Tyserkhan004V2 0 — 4y
Ad

Answer this question