Hello, im trying to make a clicker game where you click a button which is a surface gui button and i wanna make the button grow from all sides when i hover with mouse over the button.
I want to resize it by a percentage, so like 10% from all sides.
I have found a tutorial on YouTube which shows how to highlight objects by hovering mouse over them and I tried making the resize script but it didn’t work.
This is my script so far:
local Mouse = game.Players.LocalPlayer:GetMouse()
local cs = game:GetService("CollectionService")
Mouse.Move:Connect(function()
if not Mouse.Target then
return
end
if cs:HasTag(Mouse.Target,"Scale") then
--Resize the part from all sides by percentage
end
end)
local Mouse = game.Players.LocalPlayer:GetMouse()
local cs = game:GetService("CollectionService")
local UserInputService = game:GetService("UserInputService")
local percent = 10
local targets = {}
local function resetTargets()
for i, v in pairs(targets) do
i.Size = v
i.IsScaled.Value = false
end
targets = {}
end
Mouse.Move:Connect(function()
if not Mouse.Target then
resetTargets()
return
end
local mouseTarget = Mouse.Target
if cs:HasTag(mouseTarget,"Scale") then
local isScaled = mouseTarget:FindFirstChild("IsScaled")
if isScaled == nil then
isScaled = Instance.new("BoolValue", mouseTarget)
isScaled.Name = "IsScaled"
end
if isScaled.Value then return end
targets[mouseTarget] = mouseTarget.Size
mouseTarget.Size *= 1 + percent/100
mouseTarget.IsScaled.Value = true
else
resetTargets()
end
end)