Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you properly scale an image to the mouses position?

Asked by 6 years ago

I'm new to the scaling property when it comes to;

UDim2.new(1,0,1,0)

So I'm having a difficult time thinking of how I'd scale an image to the players mouse. I've tried stuff like this;

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local image = script.Parent:WaitForChild("ImageLabel")

image.Position = UDim2.new(mouse.X,0,mouse.Y,0)

It's a bit frustrating, because I keep getting 100 or 200 in the properties of the position just because of the way Mouse.X works.

So if anyone's out there that understands what I mean and would like to give me a solution to my problems I'm all ears.

I know you have to use math to determine the scaling, I just don't understand what type of method to use

2 answers

Log in to vote
0
Answered by 6 years ago

Hi, Acerion. In this script You donot need math.. Instead of image.Position = UDim2.new(mouse.X,0,mouse.Y,0) Try, image.Position = UDim2.new(0,mouse.X,0,mouse.Y) This should work for what you are trying to do..

Ad
Log in to vote
0
Answered by
GingeyLol 338 Moderation Voter
6 years ago

local player = game.Players.LocalPlayer local Mouse = player:GetMouse() local image = script.Parent:WaitForChild("ImageLabel") while wait() do image.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y) end

Answer this question