I want to make a script for a leaderboard that tweens in or out when you press v. This is the OutPut. 12:55:43.630 - Players.Player1.PlayerGui.ScreenGui.MainOpener.open and close:7: attempt to call a userdata value
Frame = script.Parent.Parent.MainFrame plr = game.Players.LocalPlayer mouse = plr:GetMouse() mouse.KeyDown:connect(function(key) if key == "v" or key == "V" then if Frame.Position == UDim2.new(.45,0,.1,0) then Frame:TweenPosition(UDim2.new(1.2,0,.1,0)"Out","Bounce",1.2) elseif Frame.Position == UDim2.new(1.2,0,.1,0) then Frame:TweenPosition(UDim2.new(.45,0,.1,0)"Out","Bounce",1.2) end end end)
Have you tried using this? You forgot to add a "," in both of the tweens. Also, the GetMouse() method to get Key presses is deprecated. I've fixed all of the problems here:
local UIS = game:GetService("UserInputService") Frame = script.Parent.Parent.MainFrame plr = game.Players.LocalPlayer --mouse = plr:GetMouse() is deprecated! --mouse.KeyDown:connect(function(key) UIS.InputBegan:connect(function(i,g) if i.KeyCode==Enum.KeyCode.V then if Frame.Position == UDim2.new(.45,0,.1,0) then Frame:TweenPosition(UDim2.new(1.2,0,.1,0),"Out","Bounce",1.2) elseif Frame.Position == UDim2.new(1.2,0,.1,0) then Frame:TweenPosition(UDim2.new(.45,0,.1,0),"Out","Bounce",1.2) end end end)