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

I cant change the size of a textbutton through script?

Asked by 2 years ago
Edited 2 years ago

script:local player = game.Players.LocalPlayer local playerUI = player:WaitForChild("PlayerGui") local presettings = playerUI:WaitForChild("Settings") local Settings = presettings:WaitForChild("Settings") local graphics = presettings:WaitForChild("Graphics") Graphics = script.Parent Graphics.MouseButton1Up:Connect(function() graphics.Visible = true game.StarterGui.Settings.Settings.Controls.Size.X = {0,150} game.StarterGui.Settings.Settings.Controls.Size.Y = {0,28} end)

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

To change the X value of a Gui:

YourGui.Size.Scale.X = 1

From the look of it your script will possibly not work (I'm not quite sure), Instead do this if your script is not located under the Gui.

-- If your script isn't located in the "StarterGui" do this

local localPlayers = game.Players.LocalPlayer
local playerGui = localPlayers:FindFirstChild("NameGui") -- The name of your gui. 
local settings = playerGui.Settings

settings.Size.Scale.X = 1

However if it is a child of the Gui then

local settings = script.Parent
settings.Size.Scale.X

To change a gui's size <----

settings.Size = UDim2.new(1, 0, 1, 0) 

Fix for your script (Hopefully)

-- Player Variables
local player = game.Players.LocalPlayer
local playerUI = player:WaitForChild("PlayerGui")

-- Gui Variables
local settingsAncestor = playerUI:WaitForChild("Settings")
local settingsChild = presettings.Settings
local controls = settingsChild.Controls
local graphics = settingsAncestor.Graphics

local textButton = script.Parent -- Changed graphics to textButton

textButton.MouseButton1Click:Connect(function()
    graphics.Visible = true
    controls.Size = UDim2.new(0, 150, 0, 28)

end)

Your script is a bit messy, and I can't tell which gui you wamt the size yo be changed, also you didn't pay attentiom to what I've written about and didn't evem bothered to modify your script. Here, hopefully will fix it

0
i want to chnge the size value of a textbutton mishokirva 22 — 2y
0
From the looks of your script, you want to change the X value of it's size. However you want to change the whole size, correct? xXLegendGamerz16Xx 231 — 2y
0
yes mishokirva 22 — 2y
0
Can you please use code block? xXLegendGamerz16Xx 231 — 2y
View all comments (24 more)
0
what is code block mishokirva 22 — 2y
0
Anyways I have edited it, try it, and let me know if there's an error xXLegendGamerz16Xx 231 — 2y
0
x cannot be assigned to mishokirva 22 — 2y
0
i dont want to change the size of gui i want to change the textbuttons size mishokirva 22 — 2y
0
Cam you please show me to whole script you constructed xXLegendGamerz16Xx 231 — 2y
0
Also usw code block xXLegendGamerz16Xx 231 — 2y
0
whats codeblock mishokirva 22 — 2y
0
Lemme edit my answer hold on xXLegendGamerz16Xx 231 — 2y
0
There xXLegendGamerz16Xx 231 — 2y
0
inside where mishokirva 22 — 2y
0
Inside the ~ xXLegendGamerz16Xx 231 — 2y
0
lol sorry mishokirva 22 — 2y
0
thats my script mishokirva 22 — 2y
0
what do i do mishokirva 22 — 2y
0
I've edited it, try and see if it works xXLegendGamerz16Xx 231 — 2y
0
Tell me if any problem comes up xXLegendGamerz16Xx 231 — 2y
0
didnt work but didnt show error mishokirva 22 — 2y
0
Can you show me your gui path xXLegendGamerz16Xx 231 — 2y
0
For example: StarterGui > Settings.Settings.Controls xXLegendGamerz16Xx 231 — 2y
0
how mishokirva 22 — 2y
0
yeah tahts it mishokirva 22 — 2y
0
Alrighty then do you have a discord xXLegendGamerz16Xx 231 — 2y
0
grandmaster1o1#1515 mishokirva 22 — 2y
0
Mines kei, accept it xXLegendGamerz16Xx 231 — 2y
Ad

Answer this question