With this script I want to open/close my gui with an animation when I press *. I'm learning lua and I'm not very good so maybe someone can fix my script and explain me why isn't working.
This is my script:
wait()
local frame = script.Parent.Parent.Parent.Parent.Parent:WaitForChild('MODmenu').Frame
local toggle = false
local Player = game.Players.LocalPlayer --TODO: get service
local Mouse = Player:GetMouse()
local k = script.Parent.Parent.Parent.Key.Value
local key = string.lower(k)
Mouse.KeyDown:connect(function(Key)
if (Key==key)then
if toggle == false then
frame:TweenPosition(UDim2.new(0,0,0,0), 'Out', 'Bounce', 1)
script.Parent.Text = "* to close"
toggle = true
else
frame:TweenPosition(UDim2.new(0,-500,0,0), 'Out', 'Bounce', 1)
script.Parent.Text = "* to open"
toggle = false
end
end
end)
(note: they key is in a value)
