I have this main lobby that I’m using, I’ve searched for about two hours for an answer and cant find one. I just want to make it so when the person spawns in the npc makes itself look like the local characters avatar (character that spawned in) but everyone else’s one shows their avatar, I just want the looks to be client sided, I’ve tried a lot of stuff I don’t know what to do. Thanks, appreciate it!.
Either teleport the player there, make the server
apply a humanoidDescription
on a cloned dummy, which he then puts somewhere inside ReplicatedStorage
after which the client
waits for said dummy, the dummy should be the name of the player or anything like that, then the client
has to position the dummy and you are done.
Sadly clients cannot apply a humanoidDescription
, so this is your best option
Otherwise you can always just move the player over into that dummy, make it so that they cannot move by anchoring them.
How would I do this? – make the server
apply a humanoidDescription
on a cloned dummy, which he then puts somewhere inside ReplicatedStorage
after which the client
waits for said dummy, the dummy should be the name of the player or anything like that, then the client
has to position the dummy and you are done.
Either use a RemoteFunction
, start from the client -> server -> client
, because RemoteFunctions
allow you to send a request after which you will have to wait until a response is given.
Now you can either use that to get the AppliedDummy
or you could use Players.PlayerAdded
, when a player joins then create a dummy with the humanoid description.
You can apply a humanoid description like so, first we get the outfit with Players:GetHumanoidDescriptionFromUserId() then we have to apply said HumanoidDescription
to the Dummy’s humanoid with Humanoid:ApplyDescription()
Important: Make sure that the dummy has all the attachments
necessary else accessories
will not be applied properly
How and where would I put these into a script into my game, sorry if that sounds dumb, its 4am I’m gonna go bed and check on this when I wake up, Thanks for the help!
Okay so first you want to fire a RemoteFunction and you’ll expect to get a dummy in return (the client will wait until it gets a result). This would look something like so:
-- RemoteFunction variable:
local getAppliedDummy = game:GetService("ReplicatedStorage"):WaitForChild("GetAppliedDummy")
-- Request:
local dummy = getAppliedDummy:InvokeServer()
Server:
local getAppliedDummy = game:GetService("ReplicatedStorage"):WaitForChild("GetAppliedDummy")
local Dummy = ... -- path to the original dummy
local function onRequest(player)
local cloned = Dummy:Clone()
... -- Apply humanoid description here
return cloned
end
getAppliedDummy.OnServerInvoke = onCreatePartRequested
where do i put these scripts, and what do i do for “apply humanoid description here” ?
I put this script in serverscriptservice
local Dummy = game:GetService("Workspace"):WaitForChild("LogAvatar") -- path to the original dummy
local function onRequest(player)
local cloned = Dummy:Clone()
-- Apply humanoid description here, dont know what do do?!
return cloned
end
getAppliedDummy.OnServerInvoke = onCreatePartRequested
I put this in starterplayerscripts
-- RemoteFunction variable:
local getAppliedDummy = game:GetService("ReplicatedStorage"):WaitForChild("DummyFunction")
-- Request:
local dummy = getAppliedDummy:InvokeServer()
When i start the game I get an error saying " InvokeServer is not a valid member of RemoteEvent “ReplicatedStorage.DummyFunction”
and “Infinite yield possible on 'ReplicatedStorage:WaitForChild(“GetAppliedDummy”)”
Server:
local PlayerService : Players, ReplicatedStorage : ReplicatedStorage = game:GetService("Players"), game:GetService("ReplicatedStorage")
local Dummy = game:GetService("Workspace"):WaitForChild("LogAvatar") -- path to the original dummy
local function onRequest(player)
if ReplicatedStorage:FindFirstChild(player.Name) then
-- Delete any old dummy
ReplicatedStorage[player.Name]:Destroy()
end
-- create a new dummy:
local cloned = Dummy:Clone()
local playerDesc = PlayerService:GetHumanoidDescriptionFromUserId(playerId)
clone:WaitForChild("Humanoid"):ApllyDescription(playerDesc)
clone.Parent = game:GetService("ReplicatedStorage")
clone.Name = player.Name
game:GetService("Debris"):AddItem(clone, 60) -- delete the clone after 60 sec
return cloned
end
getAppliedDummy.OnServerInvoke = onRequest
Client:
-- RemoteFunction variable:
local getAppliedDummy = game:GetService("ReplicatedStorage"):WaitForChild("DummyFunction")
-- Request:
local debrisDummy = getAppliedDummy:InvokeServer() -- This dummy will get cleared
local dummy = debrisDummy:Clone() -- Actual dummy
Make sure the dummy has attachments like ‘HairAttachment’ etc inside of itself, else attachments will not be put correctly onto the dummy.