local R15Rig = script:WaitForChild("R15")
local R6Rig = script:WaitForChild("R6")
local Players = game:GetService("Players")
local gui = script:WaitForChild("characterLoaderUi")
local coreGui = game:GetService("CoreGui")
local Players = game:GetService("Players")
local selection = game:GetService("Selection")
local function loadCharacter(id,rigtype)
if rigtype == Enum.RigType.R15 then
local rig = R15Rig:Clone()
rig.Parent = workspace
local DescriptionHumanoid = Players:GetHumanoidDescriptionFromUserId(id)
rig.Humanoid:ApplyDescription(DescriptionHumanoid)
return rig
elseif rigtype == "R6" then
local rig = R6Rig:Clone()
rig.Parent = workspace
local DescriptionHumanoid = Players:GetHumanoidDescriptionFromUserId(id)
rig.Humanoid:ApplyDescription(DescriptionHumanoid)
return rig
elseif rigtype == "CurrentRig" then
return Players:CreateHumanoidModelFromDescription(Players:GetHumanoidDescriptionFromUserId(id),Enum.RigType.R15)
end
end
local iconId = ""
local toolbar = plugin:CreateToolbar("quickLoadCharacter")
local button = toolbar:CreateButton("Quick load char","Toggle ui",iconId)
button.Click:Connect(function()
gui.Parent = gui.Parent == coreGui and script or coreGui
end)
local textBox = gui.Frame.userTextBox
local ImageLabel = gui.Frame.ImageLabel
local LoadAsR15 = gui.Frame.LoadAsR15
local LoadAsR6 = gui.Frame.LoadAsR6
local LoadAsCurrentRigtypeOfCharacter = gui.Frame.LoadAsCurrentRigtypeOfCharacter
textBox.FocusLost:Connect(function()
local userId = tonumber(textBox.Text) or nil
if userId ~= nil then else
local result
local success,err = pcall(function()
result = Players:GetUserIdFromNameAsync(textBox.Text)
end)
if success and result ~= nil then
userId = result
end
if not success then
textBox.Text = ""
end
end
if userId ~= nil then
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
if isReady then
ImageLabel.Image = content
end
end
end)
LoadAsR6.MouseButton1Click:Connect(function()
local userId = tonumber(textBox.Text) or nil
if userId ~= nil then else
local result
local success,err = pcall(function()
result = Players:GetUserIdFromNameAsync(textBox.Text)
end)
if success and result ~= nil then
userId = result
end
if not success then
textBox.Text = ""
end
end
if userId ~= nil then
local RigLoaded = loadCharacter(userId,"R6")
RigLoaded.Parent = selection:Get()[1] or workspace
RigLoaded:PivotTo(workspace.CurrentCamera.CFrame)
end
end)
LoadAsR15.MouseButton1Click:Connect(function()
local userId = tonumber(textBox.Text) or nil
if userId ~= nil then else
local result
local success,err = pcall(function()
result = Players:GetUserIdFromNameAsync(textBox.Text)
end)
if success and result ~= nil then
userId = result
end
if not success then
textBox.Text = ""
end
end
if userId ~= nil then
local RigLoaded = loadCharacter(userId,Enum.RigType.R15)
RigLoaded.Parent = selection:Get()[1] or workspace
RigLoaded:PivotTo(workspace.CurrentCamera.CFrame)
end
end)
LoadAsCurrentRigtypeOfCharacter.MouseButton1Click:Connect(function()
local userId = tonumber(textBox.Text) or nil
if userId ~= nil then else
local result
local success,err = pcall(function()
result = Players:GetUserIdFromNameAsync(textBox.Text)
end)
if success and result ~= nil then
userId = result
end
if not success then
textBox.Text = ""
end
end
if userId ~= nil then
local RigLoaded = loadCharacter(userId,"CurrentRig")
RigLoaded.Parent = selection:Get()[1] or workspace
RigLoaded:MoveTo(workspace.CurrentCamera.Position)
end
end)
yes ik moveto is suspreded with pivotto but pivotto dosent work either