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

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

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

2 comments

0

You need th player Gui not the StarterGui

0

still wont work :/

1 answer

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.

1 comment

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

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