local frame = script.Parent.Parent.userInterface.badgeFrame
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
frame.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
local badge = Instance.new("TextLabel", script.Parent.Parent.userInterface.badgeFrame)
badge.Size = UDim2.new(0,50,0,50)
badge.Text = ""
badge.BackgroundColor3 = Color3.new(0, 0.666667, 1)
badge.AnchorPoint = Vector2.new(.5,.5)
badge.Position = UDim2.new(0.5, mouse.X, 0.5, mouse.Y) - THIS LINE
end
end)
Could you explain more about what the issue is?
Sure, I want the text label’s position to be the mouse’s position. RN it is very far and lower to the right of the mouse.
Im pretty sure all you have to do is remove the 0.5 in the scale columns
UDim2.new(0,mouse.X,0,mouse.Y)
I believe you’d need to remove the 0.5 in the UDim2 but I’m not sure, could you try that?
You also could create a loop and keep setting it until you don’t want to.
Yes the mouse’s position is only offset, if you put a GUI at the mouse’s position then apply scale it will mess it up.
As @PapaBreadd said remove the scale in the UDim2
Do
local absPos = frameThatYourePuttingItIn.AbsolutePosition
UDim2.new(0,mouse.X-absPos.X,0,mouse.Y-absPos.Y)
I just realised, you are trying to use InputBegan on a frame.
InputBegan is a member of UserInputService.
If you wanna click on a gui, you can use GuiButton.MouseButton1Click
Its of both
Kinda confusing on roblox’s part but
My bad. Never seen InputBegan in GuiObject.
That makes it outside of the screen
Can you show your code?
It works for me in my testing
oh wait. the way i put it into my code, it didn’t acocunt for the tween. So i got it after the tween and it works. Thank you
I think you should make;
UDim2.new(0, mouse.X/SizeOfFrame, 0, mouse.Y/SizeOfFrame)