I am trying to setup a type of player list displaying certain stats, but I am having an issue where running the function will entirely work, but it’ll throw an error at the end of it. I have it bound to UserInputService.InputBegan, and should only run if the user hits TAB. Here is what I have, as well as the console errors.
local Services = require(game:GetService("ReplicatedStorage"):WaitForChild("Services"))
local Frame = script.Parent
local Slots = {Frame.Player1, Frame.Player2, Frame.Player3}
local Hidden = false
wait()
Services.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
Services.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, false)
Services.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
for _, Slot in pairs(Slots) do Slots.Visible = false end
function InputBegan(Input)
if Input.UserInputType == Enum.UserInputType.Keyboard and Input.KeyCode == Enum.KeyCode.Tab then
if Hidden then
Hidden = not Hidden
Frame.Client:TweenPosition(UDim2.new(1, 0, 0, Frame.Client.Position.Y.Offset), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 0.3, true)
for _, Slot in pairs(Slots) do
print(Slot, typeof(Slot), Slot.Position, typeof(Slot.Position))
Slot:TweenPosition(UDim2.new(1, -10, 0, Slot.Position.Y.Offset), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 0.3, true)
end
else
Hidden = not Hidden
Frame.Client:TweenPosition(UDim2.new(1.2, -60, 0, Frame.Client.Position.Y.Offset), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 0.3, true)
for _, Slot in pairs(Slots) do
print(Slot, typeof(Slot), Slot.Position, typeof(Slot.Position))
Slot:TweenPosition(UDim2.new(1.15, 0, 0, Slot.Position.Y.Offset), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 0.3, true)
end
end
end
end
“Handler” is the script that is currently running. “Slots” is simply just a table of the three frames called, “Player1”, “Player2”, “Player3”.
I am not exactly sure where to look to fix this as printing what my code is using shows that it’s an Instance, but the error is saying it’s a boolean…? Strangely, it does what it’s intended, and does tweenposition like it’s suppose to. It just errors after the FOR loop finishes.
Also, ignore the roblox warning. That is just self reminder of my code lol.