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

How to make a gui size grow when holding down a mouse button on a part?

Asked by 5 years ago

i asked a question before about this, i made a script but it wont work :/ the gui is in starter gui and the script is as follow:

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

Mouse.Button1Down:connect(function()
    game.StarterGui.Load.Enabled = true
    game.StarterGui.Load.Frame.TextButton.Bar.Size = UDim2.new(.99,0,1,0, "Out", "Linear",5)
    wait()
end)

i want it so the player has to be HOLDING down the left mouse key in order for the gui to go up, like in mining simulator but it wont work. this script is in a local script

0
You need th player Gui not the StarterGui User#5423 17 — 5y
0
still wont work :/ cruizer_snowman 117 — 5y

1 answer

Log in to vote
0
Answered by
yyyyyy09 246 Moderation Voter
5 years ago

You would want something like this:


local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() Mouse.Button1Down:connect(function() game.StarterGui.Load.Enabled = true game.StarterGui.Load.Frame.TextButton.Bar:TweenSize(UDim2.new(.99,0,1,0), "Out", "Linear",5) wait() end) Mouse.Button1Up:connect(function() game.StarterGui.Load.Frame.TextButton.Bar:TweenSize(UDim2.new(0,0,0,0), "Out", "Linear",0.01, true) game.StarterGui.Load.Enabled = false wait() end)

You seemed to be mistaken when it came to tweensize, UDim2 does not have the parameters that you put into the UDim2. I added a true to the second tweensize so that it overrides the original tweensize when you stop holding your left click down.

Hopefully this helps you out.

0
it wont let me click/ hold down the left mouse button on the object :/ The object does have a click detector in there, but thats for another script cruizer_snowman 117 — 5y
Ad

Answer this question