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

How do you change a SurfaceGUI's size when you have a GUI that moves across?

Asked by 8 years ago

Hello! I want to know how to change a SurfaceGui's size and text upon click on a GUI. It partly works, but it doesn't fully work. Here is the script in the GUI itself:

while true do
wait(0.05)
if script.Parent.Value.Value == 0 then
script.Parent.sign.Text = "Not in Service"
game.Workspace.twm4041.train.intdisplay.display1.SurfaceGui.ST1.TextLabel.Text = "Not in Service"
game.Workspace.twm4041.train.intdisplay.display1.SurfaceGui.ST1.TextLabel.Size = UDim2.new(1, 0, 1, -16)
game.Workspace.twm4041.train.intdisplay.display2.SurfaceGui.ST1.TextLabel.Text = "Not in Service"
game.Workspace.twm4041.train.intdisplay.display2.SurfaceGui.ST1.TextLabel.Size = UDim2.new(1, 0, 1, -16)
game.Workspace.twm4041.train.intdisplay.display3.SurfaceGui.ST1.TextLabel.Text = "Not in Service"
game.Workspace.twm4041.train.intdisplay.display3.SurfaceGui.ST1.TextLabel.Size = UDim2.new(1, 0, 1, -16)
game.Workspace.twm4041.train.intdisplay.display4.SurfaceGui.ST1.TextLabel.Text = "Not in Service"
game.Workspace.twm4041.train.intdisplay.display4.SurfaceGui.ST1.TextLabel.Size = UDim2.new(1, 0, 1, -16)
end

if script.Parent.Value.Value == 1 then
script.Parent.sign.Text = "The next station is Callerton Parkway. Please take care when using the level crossing"
game.Workspace.twm4041.train.intdisplay.display1.SurfaceGui.ST1.TextLabel.Text = "The next station is Callerton Parkway. Please take care when using the level crossing"
game.Workspace.twm4041.train.intdisplay.display1.SurfaceGui.ST1.TextLabel.Size = UDim2.new(4, 0, 1, -16)
game.Workspace.twm4041.train.intdisplay.display2.SurfaceGui.ST1.TextLabel.Text = "The next station is Callerton Parkway. Please take care when using the level crossing"
game.Workspace.twm4041.train.intdisplay.display2.SurfaceGui.ST1.TextLabel.Size = UDim2.new(4, 0, 1, -16)
game.Workspace.twm4041.train.intdisplay.display3.SurfaceGui.ST1.TextLabel.Text = "The next station is Callerton Parkway. Please take care when using the level crossing"
game.Workspace.twm4041.train.intdisplay.display3.SurfaceGui.ST1.TextLabel.Size = UDim2.new(4, 0, 1, -16)
game.Workspace.twm4041.train.intdisplay.display4.SurfaceGui.ST1.TextLabel.Text = "The next station is Callerton Parkway. Please take care when using the level crossing"
game.Workspace.twm4041.train.intdisplay.display4.SurfaceGui.ST1.TextLabel.Size = UDim2.new(4, 0, 1, -16)
end

end

And here is the scrolling GUI script

local images = {script.Parent.TextLabel}

while wait() do 
    for _,v in pairs(images) do
        local temp = v.Position.X.Scale
        if (temp <= -v.Size.X.Scale) then
            temp = 1.0
        end
        v.Position = UDim2.new(temp - 0.02, 0, 0, 0)
    end
end

The problem is that the surfaceGUI keeps flicking between the two texts (and sizes) This is not what I want. It would be very helpful if someone could help me, as I have not yet found a solution.

Many thanks

BlackpoolTransport

0
please use variables oh dear god organize that dirty_catheter 7 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Found the solution.

Ad

Answer this question