Hello fellow reader! I need help scripting my UI, let me explain it as much as I can. So basically I want the UI to do this, when you hover over the button, it changes into a white button, and when you press on it the button turns blue. There are 3 buttons, a loadout button, a crate button and a shop button. I already have the script for the loadout button but, my problem is that I don’t know how to fix this. I want the script from the loadout button to do the same thing as this one. Here’s a video of what I want the shop and crate button to do.
robloxapp-20210425-2017320.wmv (528.9 KB)
Basically I’m just wondering if anyone knows a similar way to do this or help me do what I want the UI to do, also, here’s the explorer properties for the UI.
Here’s the script down below. I didn’t add the image ids because I didn’t want anyone to take my work. Anyways here’s the script.
local CratesButton = script.Parent.Parent.CratesButton
local ShopButton = script.Parent.Parent.ShopButton
script.Parent.MouseEnter:Connect(function()
if script.Parent.Image == "Image" then
script.Parent.Image = "Image"
else
CratesButton.TweenScript.Disabled = true -- Disables Hover Script for Crates Button
ShopButton.TweenScript.Disabled = true -- Disables Hover Script for Shop Button
script.Parent.Image = "Image"
script.Parent:TweenSize(UDim2.new(0.148,0 ,0.068,0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, .2, false)-- Size Tweener
script.Parent.ZIndex = 2
end
end)
script.Parent.MouseLeave:Connect(function()
if script.Parent.Image == "Image" then
script.Parent.Image = "Image"
else
script.Parent.Image = "Image"
script.Parent:TweenSize(UDim2.new(0.127, 0,0.061, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, .2, false)-- Size Tweener
script.Parent.ZIndex = 1
CratesButton.TweenScript.Disabled = false -- Enables Hover Script for Crates Button
ShopButton.TweenScript.Disabled = false -- Enables Hover Script for Shop Button
end
end)
script.Parent.MouseButton1Click:Connect(function()
CratesButton.TweenScript.Disabled = true -- Disables Hover Script for Crates Button
ShopButton.TweenScript.Disabled = true -- Disables Hover Script for Shop Button
CratesButton:TweenSize(UDim2.new(0.127, 0,0.061, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, .2, false)-- Size Tweener
ShopButton:TweenSize(UDim2.new(0.127, 0,0.061, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, .2, false)-- Size Tweener
script.Parent.ZIndex = 2
script.Parent:TweenSize(UDim2.new(0.148,0 ,0.068,0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, .2, false)-- Size Tweener
script.Parent.Image = "Image"
end)