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

How do I make so this surface gui works in game and not only in studio?

Asked by 4 years ago

I'm trying to script a computer with Surface Guis, all seems fine on studio, but when I play the game it won't work. For example, there's a On/Off button that works with a Click Detector and make the computer show a "Initializing" screen, but when I play the game it does not work. Here's part of the script:

game.Players.PlayerAdded:Connect(function(plr)
    pcbutton.ClickDetector.MouseClick:connect(function()
        if energyon == true and pcon == false then
            pcbutton.Click:Play()
            comp.Tela.Color = Color3.fromRGB(70,70,70)
            game:GetService("Workspace").Computador.Tela.Reflectance = 0
            pcon = true
            pcbutton.BrickColor = BrickColor.new("Lime green")
            pcbutton.Material = Enum.Material.Neon
            pcbutton.ClickDetector:Destroy()
            local initializer = game:GetService("Workspace").Computador.Tela.Initializing
            initializer.Enabled = true


            for i=0, 3 do
                initializer.TextLabel.Text = "Initializing PC."
                wait (0.8)
                initializer.TextLabel.Text = "Initializing PC.."
                wait(0.8)
                initializer.TextLabel.Text = "Initializing PC..."
                wait(0.8)
            end

*This is a Global Script.

0
for i=0, 3 do Would loop infinitely raid6n 2196 — 4y
0
Why would it loop infinitely? ScuffedAI 435 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Might be this: ~~~~~~~~~~~~~~~~~ game.Players.PlayerAdded:Connect(function(plr) pcbutton.ClickDetector.MouseClick:connect(function() ~~~~~~~~~~~~~~~~~

Try clicking whatever you need to click

0
What did you change? ArcanZus 61 — 4y
0
Umm nothing, you need to click the pcbutton SharkTailOof 22 — 4y
Ad

Answer this question