Gui does not change position

Hello, Basically i’m tryna make a gui That almost every single simulator game has, You do something and a gui about it pops up, as example “+1 Strength” and yk it goes up then disappears. so basically thats what im tryna do but theres some error that i literally can not understand

 local NewGui = StrengthFrame:Clone()
		NewGui.Parent = playerGui.StatGains (its a screengui)
		NewGui.Position =  UDim2.new({math.random(0.1,0.950),0},{math.random(0.150,0.800),0})

i’m copying a gui which was in replicated storage, parenting it to a screen gui then im trying to change the position of the frame but for some reason it does not change the position of the frame
i don’t have much experience about gui’s, ill appreciate it alot if one of u guys find the solution

2 Likes

local Gui = script.Parent
local TweenService = game:GetService(“TweenService”)

local info = TweenInfo.new(

0.25, – How fast should it be played
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)

local Goals =
{

Position = UDim2.new(0.859, 0,0.376, 0); --Position that you want it to be

}

local ButtonTween = TweenService:Create(Gui, info, Goals)
ButtonTween:Play()

Gui.LocalScript.Disabled = false

– make a local script into the frame/gui you want to make that will self destroy after 1 second
–[[

like this:
wait(1)
script.Parent:Destroy

]]

replace this
UDim2.new({math.random(0.1,0.950),0},{math.random(0.150,0.800),0})
with this
UDim2.new(math.random(0.1,0.950),0,math.random(0.150,0.800),0)

it is annoying but when you copy it you need to remove the { } { } that roblox puts in the text

thats not really what i am looking for unfortunately

i have responded with the error fix
i assume that’s what you are looking for
its 1 post above but here is the link anyways
Gui does not change position | Post

i removed the “{},{}” and still nothing has changed

can you show me what exacly you did?
(i mean by that as script)

i didn’t really do any changes except for removing the “{}”'s

local NewGui = StrengthFrame:Clone()
		NewGui.Parent = playerGui.StatGains
		NewGui.Position =  UDim2.new(math.random(0.1,0.950),0,math.random(0.150,0.800),0)

Try this:

NewGui.Position = UDim2.new(0+math.random(0.1,0.950), 0, 0+math.random(0.150,0.800), 0)

i found out the problem you cant math.random under 1
example
math.random(0.5,0.8)
(it always comes out as 0)
Sorry that it took time to reply i just thought i replied yesterday

I found a little fix to this
NewGui.Position = UDim2.new(math.random(10,95)/100,0,math.random(15,80)/100,0)
i printed it and it works correctly


if you want better results you can add a 0 to all of the numbers i changed
like
NewGui.Position = UDim2.new(math.random(100,950)/1000,0,math.random(150,800)/1000,0)