Crazy UDim2 stuff

Issue


My issue is that UDim2 isn’t working. Here’s my code:

local Request = script.Parent.Request.ClickDetector
local TakeAwayRequest = script.Parent.TakeAwayRequest.ClickDetector
local Screen = game.Workspace.Map.Workspace.VoidClan.VoidClanLead
local portal = game.Workspace.Map.Portal

local requestdebounce = false
--if debounce = false, make a request, if its true, take away request

local function Requester()
	if requestdebounce == false then
		Screen.SurfaceGui.TextLabel.Text = "Requesting to speak / Speaking."
		Screen.SurfaceGui.TextLabel.TextTransparency = 0
		portal.VoidClan.TextLabel.Text = "VC: Requesting"
		portal.VoidClan.TextLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
		wait()
		portal.VoidClan.TextLabel.Position = UDim2.new{0, -400, 0, -300}
		requestdebounce = true
	elseif requestdebounce == true then
		Screen.SurfaceGui.TextLabel.Text = "Taking away request to speak."
		portal.VoidClan.TextLabel.Text = "VC: Idle"
		portal.VoidClan.TextLabel.TextColor3 = Color3.fromRGB(56, 65, 226)
		portal.VoidClan.TextLabel.Position = UDim2.new{0, -520, 0, -300}
		wait(1)
		Screen.SurfaceGui.TextLabel.TextTransparency = 1
		requestdebounce = false
	end
end

Request.MouseClick:Connect(Requester)
TakeAwayRequest.MouseClick:Connect(Requester)

Whenever the function fires, the text label always goes to {0, 0}, {0, 0} on the “Portal” part. instead of the values provided within the brackets inside of UDim2.new

I don’t really know why this is happening. Does anybody know why this is happening by any chance? I know I haven’t provided much info on the issue, but I don’t really know what to provide, so if you need more info ask me and I will do my best to provide it.

Already Tried Solutions


1: using UDim2.fromOffset
(In which UDim2 has a seizure and makes the position {0, 0, -400, 0} and {0, 0, -520, 0} )
2: using UDim2.fromScale
(In which UDim2 has a seizure again and makes the position {0, 0, -400, 0} and {0, 0, -520, 0} )
3: Checking if any other script is changing the position of the text label (which there is not)

3 Likes

You should be using (), not {}. Do this instead.:

Position = UDim2.new(.5, 0, .5, 0) -- replace with your position
2 Likes