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

GUI will not Work in an actual server, How to fix? I fixed it Myself.

Asked by 9 years ago

I'm pretty sure it will not work because it's a GUI with a local script inside of StarterGui and i'm not adding it to the player directly. So, When I play it in studio, the second I spawn it will work. Then I play in a server and no function work. Here is the "layout" of my GUI: StartMenu> LocalScript About Play Backing Info>Minimize Text1

And here is the script (Sorry it's not very organized with connect

Player = game.Players.LocalPlayer
Menu = script.Parent
Play = Menu.Play
About = Menu.About
HasPressedPlay = false
Info = Menu.Info
Minimize = Info.Minimize

function MouseEnterPlayButton()
    Play.FontSize = "Size36"
    Play.BackgroundColor3 = Color3.new(0.1, 0.65, 0.71)
    Play.Size = UDim2.new(0.45, 0, 0.225, 0)
end

function MouseLeftPlayButton()
    Play.FontSize = "Size24"
    Play.BackgroundColor3 = Color3.new(0.54, 0.62, 0.7)
    Play.Size = UDim2.new(0.4, 0, 0.1, 0)
end


function MouseEnterAboutButton()
    About.FontSize = "Size36"
    About.BackgroundColor3 = Color3.new(0.1, 0.65, 0.71)
    About.Size = UDim2.new(0.45, 0, 0.225, 0)
end

function MouseLeftAboutButton()
    About.FontSize = "Size24"
    About.BackgroundColor3 = Color3.new(0.54, 0.62, 0.7)
    About.Size = UDim2.new(0.4, 0, 0.1, 0)
end

function PlayGame()
    if HasPressedPlay == false then
        for GuiMove = 1, 30 do
            if GuiMove <= 20 then
                Play.Position = Play.Position + UDim2.new(0.05, 0, 0, 0)
            end
            if GuiMove >= 10 then
                About.Position = About.Position + UDim2.new(0.05, 0, 0, 0)
            end
            wait()
        end
        Menu:remove()
    end
end

function MinimizeInfo()
    Info.Visible = false
end

function InfoPopup()
    if Info.Visible == false then
    Info.Visible = true
else
    Info.Visible = false
    end 
end

About.MouseButton1Down:connect(InfoPopup)
Minimize.MouseButton1Down:connect(MinimizeInfo)
Play.MouseLeave:connect(MouseLeftPlayButton)
Play.MouseEnter:connect(MouseEnterPlayButton)
Play.MouseButton1Down:connect(PlayGame)

About.MouseLeave:connect(MouseLeftAboutButton)
About.MouseEnter:connect(MouseEnterAboutButton)

0
Would I need like a regular script in Workspace to put this inside a player? the Playeradd function? alphawolvess 1784 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

I have the same script (Minus I changed my variable Info to script.Parent.Info which did not matter) but I made line 1 become wait() This solved it. My error showing in an actually server was there being no Info. I didn't get it so I decided to add a wait before the script even reads the variables. Seems it worked flawlessly.

Ad
Log in to vote
-1
Answered by 9 years ago

When you are doing if statements, you do not have to use Boolean such as True or False. A better way to do this is to use Not, And, and/or Or so for example:

if not HasPressedPlay  then

is the same as

if HasPressedPlay == false then

Answer this question