upon impersonate.MouseButton1Click event firing, fire a remote event containing the userid you want in the fireserver argument
Have the server read the userid argument on a .OnServerEvent connection and use GetHumanoidDescriptionFromUserId(userId) on that userid
Apply the humanoiddescription that you got to the player’s character’s humanoid(the player who fired is always the first arg in a .OnServerEvent so you can get their character from there)
I was not aware that it was available for clients to use now for local rigs. But OP is trying to use it on their own character which i’m not sure if it works or not.
I’ve found a new method! Borrowing some code from a plugin, I’ve got a way to load the character into the game. This is my new code:
impersonate.MouseButton1Click:Connect(function()
local e = bruh(user.Text, workspace, morph == "R15" and true or false)
e.Parent = workspace
e.Humanoid.NameDisplayDistance = 0
e.HumanoidRootPart.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame
game.Players.LocalPlayer.Character = e
game.Workspace.Camera.CameraSubject = e.Head
end)
Although, when I do this, everything but the animations works. The animations script is in my model, but nothing is being animated. Do you have any idea how I can make the animations work?
Create a RemoteEvent in ReplicatedStorage (or any where you want)
Create a server script and type the following
Server Script
local event = game.ReplicatedStorage.RemoteEvent -- Our event
event.onServerEvent:Connect(function(player,user) -- When event is triggered [stores player and the user text]
local userId = game.Players:GetUserIdFromNameAsync(user)
local humDesc = game.Players:GetHumanoidDescriptionFromUserId(userId)
player.Character.Humanoid:ApplyDescription(humDesc)
end)
Your local script
local event = game.ReplicatedStorage.RemoteEvent
impersonate.MouseButton1Click:Connect(function()
event:FireServer(user.Text)
end)