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

Move GUI's around to random positions?

I tried this but the coords end up wrong. I am trying to make it show a text label at a random place every time a player clicks it. It just ends up nowhere!. Pls, help!

local Plr = script.Parent.Parent.Parent
local DB = false
local Sound = script.Parent:FindFirstChild("Sound")
local GUI = game.StarterGui.ScreenGui:FindFirstChild("TextLabel")
script.Parent.Activated:Connect(function()
	if DB == false then
		DB = true
	
	if Plr then
		local Multi = Plr.HiddenStats:FindFirstChild("Multiplier")
		local Chill = Plr.leaderstats:FindFirstChild("Chill")
		if Multi and Chill then
			Chill.Value = Chill.Value + 1 * Multi.Value
			Sound:Play()
			
			local Clone = GUI:Clone()
			Clone.Parent = Plr.PlayerGui:FindFirstChild("ScreenGui")
			Clone.Position = UDim2.new(math.random(0,1),0,math.random(0,1),0)--The part that messes up!
			Clone.Visible = true
			Clone.Text = "+"..Multi.Value
			wait(1)
			Clone:Destroy()
			
		end
	end
	local Delay = Plr.HiddenStats:FindFirstChild("Delay")
	wait(Delay.Value - 1)
	DB = false
	end
end)

1 answer

✓ Accepted answer

Hello so i see your problem

Well i don't really know if this works but try it:

Clone.Position = UDim2.new(0,math.random(0,900), 0,math.random(0,900))

1 comment

0

uh

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