How do you Make a Tween GUI when a Tool is Equipped

so Im Trying to make a Tween GUI when a Tool is equipped and I have been Searching for hours on how to do this and there’s been no information

i tried Looking on Youtube to see if there was any but nothing, i even Used the Roblox Developer Website to see if i Could Figure this out but nothing

I have a Script when a Tool is equipped the Gui Pops up but i Want to Add a Tween with it

local tool = script.Parent
local player = game.Players.LocalPlayer

local gui = player:WaitForChild(“PlayerGui”).(continue with the location of your gui)

tool.Equipped:Connect(function()
gui.Enabled = true
end)

tool.Unequipped:Connect(function()
gui.Enabled = false
end)

just put :TweenPosition(Udim.new(new position), "Out", "Sine", .2, true) when equipped instead of enabling it
and putTweenPosition(Udim.new(old position), "Out", "Sine", .2, true) when unequipped instead of enabling it

PS MAKE SURE THE GUI IS ENABLED

1 Like

Instead, you should try using TweenService. Using TweenService allows you to disconnect a tween track in case it’s still playing when you equip the tool again.

local sp = script.Parent --USING A VARIABLE FOR SCRIPT.PARENT SAVES ON SO MUCH WRITING

local open
local close

local TS = game:GetService("TweenService")
local Info = TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingStyle.In)

tool.Equipped:Connect(function()
    if close then close:Cancel() end
    open = TS:Create(yourFrame,Info,{Position = UDim2.new(yourPosition)})
    open:Play()
end)

tool.Unequipped:Connect(function()
    if open then open:Cancel() end
    close = TS:Create(yourFrame,Info,{Position = UDim2.new(yourPosition)})
    close:Play()
end)

Doing this for UIs will make them feel more responsive too!

1 Like