Alright yet another question you people probably know off the top of your head with little effort somehow
I’m trying to make it so the monster in a game I’ve made copies the player’s avatar (for the humor I guess)
I’ve tried something like: firing a remote event for all clients (its a 1 player game) that makes a local script get the local player’s user id which then applies it to a string value AND fire server’s the remote event and then a server script reads that value and applies it to the character
local Players = game:GetService("Players")
local Dum = workspace.NailaWindow
local player = game:GetService("Players").LocalPlayer
local ID = workspace.Value.Value --or remove this and put user id
game.ReplicatedStorage.GetCharacter.OnServerEvent:Connect(function()
local function CreateOfflineCharacter(UserID, Dummy)
local Appearance = Players:GetHumanoidDescriptionFromUserId(UserID)
Dummy.Humanoid:ApplyDescription(Appearance)
end
CreateOfflineCharacter(ID, Dum)
end)
I assume it doesn’t work because you can tell I was trying anything at this point and anyone who looks at this “solution” thinks I’m a huge idiot but if anyone has any tips on how I can make this work I’d like to hear them. thanks.
edit: probably also should mention I’m using a solution from another post on the same thing only that post uses a specific user id/name: How to get a player's entire model, not just their assets? - #6 by K_reex
When you change the value in the local script it doesn’t replicate to the server so its just seeing an unchanged value.
When an event is fired the first parameter is always the player that sent it so you can just do
game.ReplicatedStorage.GetCharacter.OnServerEvent:Connect(function(player)
local function CreateOfflineCharacter(UserID, Dummy)
local Appearance = Players:GetHumanoidDescriptionFromUserId(UserID)
Dummy.Humanoid:ApplyDescription(Appearance)
end
CreateOfflineCharacter(player.UserId, Dum)
end)
still not quite working but that seems like steps to fixing it
edit: okay the server script isn’t the problem it seems, the problem is the value isn’t updating to contain the userid
I see you are calling LocalPlayer on the server. This would error.
game.ReplicatedStorage.GetCharacter.OnServerEvent:Connect(function(player)
local ID = player.UserId
local function CreateOfflineCharacter(UserID, Dummy)
local Appearance = Players:GetHumanoidDescriptionFromUserId(UserID)
Dummy.Humanoid:ApplyDescription(Appearance)
end
CreateOfflineCharacter(ID, Dum)
end)
Getting the player through RemoteEvents would work in this case.
local Players = game:GetService("Players")
local function PlayerAdded(Player)
local function CharacterAdded(Character)
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidDescription = Humanoid:GetAppliedDescription()
workspace.Dummy.Humanoid:ApplyDescription(HumanoidDescription) --Path to dummy humanoid and apply HumanoidDescription
script:Destroy()
end
Player.CharacterAdded:Connect(CharacterAdded)
end
Players.PlayerAdded:Connect(PlayerAdded)
You marked my answer as a solution, did you solve it?
local Players = game:GetService("Players")
local function PlayerAdded(Player)
local function CharacterAdded(Character)
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidDescription = Players:GetHumanoidDescriptionFromUserId(Player.UserId)
workspace.Dummy.Humanoid:ApplyDescription(HumanoidDescription)
script:Destroy()
end
Player.CharacterAdded:Connect(CharacterAdded)
end
Players.PlayerAdded:Connect(PlayerAdded)
Im in a situation similar to this, I’m trying to get a decoy to be the character of the local player. Another words, if you see this decoy it will be yourself. The same if you seen this decoy, it’ll be yourself. I was able to officially get the clone, but the issue I ran into is that the decoy isn’t able to be animated for some reason. I’m cloning it from the Replicated Storage. This is the local script that I’m using in Starter Player Scripts.
local player = game.Players.LocalPlayer
local dummy = game:GetService("ReplicatedStorage").DummyPlayerMemory2:Clone()
dummy.Parent = workspace
dummy.Humanoid:ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(player.UserId))
local set = script.Settings
local sp = set.Speed
local enabled = set.Enabled
local hum = script.Parent:WaitForChild("Humanoid")
if hum then
print("Success")
else
print("No Humanoid")
end””
Default Roblox animations are controlled by a script called ‘‘Animate’’. That script is in every player’s character. What I think is that your ‘‘Dummy’’ does not contain an animation script.