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

Why won't the script I made to change the position of a gui work?

Asked by 7 years ago
local gui=script.Parent.Parent:WaitForChild("TextLabel")

wait(3)

function startgui()
    script.Parent.Position = UDim2.new(0.425,0,0.3,0)
end

print("Okay?")

I don't understand whats wrong. It prints the "Okay?" and it's not giving me any errors, but the gui wont move to the desired location.

Thanks.

1
You never called the function. GoldenPhysics 474 — 7y
0
lol cabbler 1942 — 7y
1
you need to put startgui() to call the function Volodymyr2004 293 — 7y
0
So basically just look at my answer and fix the referencing with the names and proper locations! Theevilem 23 — 7y

3 answers

Log in to vote
0
Answered by
FiredDusk 1466 Moderation Voter
7 years ago

local gui=script.Parent.Parent:WaitForChild("TextLabel")

wait(3)

function startgui() script.Parent.Position = UDim2.new(0.425,0,0.3,0) end

startgui() --Needing to call the function like the other said too. print("Okay?")

Ad
Log in to vote
0
Answered by 7 years ago

You need to put StartGui() to call the function.

Log in to vote
0
Answered by 7 years ago

You need to reference things properly in a Gui.

Here is what the script should look like:

local players = game:GetService("Players")
local player = players.LocalPlayer

local playerGui = player:WaitForChild("PlayerGui")
local screengui = playerGui:WaitForChild("NameHere")
local gui= screengui:WaitForChild("TextLabel")

local frame = script.Parent
-- Or wherever you put the script, and text label

-- First of all you never referenced back to the function you did!
-- Secondly you don't need a function to run this. Without a function it will run automatically.

frame:TweenPosition(UDim2.new(0.425,0,0.3,0), "In", "Quint", 1)
wait(0.5)
print("FIXED!")

This is your new and improved script that should work to move the Gui!

Answer this question