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

[Solved]This Script Works, but Doesn't Work! [closed]

Asked by 10 years ago

The following script only works in PlaySolo, but not in an actual server.

while true do
    wait()  
    if game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible==false then
        game.Workspace.Sound:Play()
        break
    end
end

The problem was solved by somebody on the ROBLOX forums! Thnx wazap!

Locked by TheMyrco

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
1
Answered by
Azarth 3141 Moderation Voter Community Moderator
10 years ago

You can't get LocalPlayer from a normal script, that's what it looks like you're trying to do.

local fr = game.Players["Azarth"]:WaitForChild("PlayerGui").ScreenGui.Frame
fr.Changed:connect(function(ob)
    if ob == "Visible" then 
        if not fr.Visible then
            Workspace["Sound"]:Play()
        end
    end
end)
Ad