I will get straight to the point. Basically, I have an ImageButton, but when I play my game, it shrinks to another part of the screen. Why does it do this? and how do I fix?
Is there a script anywhere that affects GUI ?
Do you use scale or offset ?
Can you send the object file ?
Make sure that when you’re in studio, you set ignoreGUIoffset to true. Not sure if this is your issue, but it might help. If not, try using scale in comparison to the screen as compared to offset, so the relative size stays the same
here is the script
local gui = script.Parent
local buttons = gui.Buttons
local clickedPlay = false
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
for i,v in pairs(buttons:GetChildren()) do
if v:IsA("ImageButton") then
-- Do effects.
v.MouseEnter:Connect(function()
v:TweenSize(UDim2.new(0.255, 0, 0.079, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.2, true)
end)
v.MouseLeave:Connect(function()
v:TweenSize(UDim2.new(0.231, 0, 0.069, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.2, true)
end)
v.MouseButton1Down:Connect(function()
if v.Name == "Play" and not clickedPlay then
-- Player clicked play.
clickedPlay = true
local t = game.TweenService:Create(gui.Fade, TweenInfo.new(1.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {["BackgroundTransparency"] = 0})
t:Play()
t.Completed:wait()
-- then continue.
gui.Background.Visible = false
gui.Buttons.Visible = false
gui.Version.Visible = false
t = game.TweenService:Create(gui.Fade, TweenInfo.new(1.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {["BackgroundTransparency"] = 1})
t:Play()
t.Completed:wait()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
gui:Destroy()
elseif v.Name == "About" then
-- Player clicked about.
gui.About.Visible = true
else
-- Player clicked updates.
gui.Updates.Visible = true
end
end)
end
end
gui.Updates.Back.MouseButton1Down:Connect(function()
gui.Updates.Visible = false
end)
gui.About.Back.MouseButton1Down:Connect(function()
gui.About.Visible = false
end)
where is the ignoreGUIoffset located at?
So this script tweens the size of a button and I don’t really see the issue, so can you send an image of before it shrinks and then after ?
sorry, my bad. it’s ignoreguiinset. it’s one of the first options under the gui item itself
Is that in Studio and then the actual game or vice-versa ?
Maybe try using the Scale property of your UI instead of the Offset.
Check this page out : GuiObject | Documentation - Roblox Creator Hub
I figured out something. It has to do with the Tween part of the script. I deleted it and now the button does not shrink.
Well I’m glad you fixed your problem.