Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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.

5 comments

1

You never called the function.

0

lol

1

you need to put startgui() to call the function

0

So basically just look at my answer and fix the referencing with the names and proper locations!

3 answers

✓ Accepted answer

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?")

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.