In my character designer I have a humanoid which is locally changed to look like the player. When the player is finished with their customizations they click “Save” and a remote event fired. On a server script, It listens for the event to be triggered and then applies the accessories to the player server-wise .This dummy that is being changed is already made.
How would I pass this model through an event, but still be able to access it in the server.
char refrenced in local script = Dummy Model in Workspace
My code looks like this.
local script
char = game.Workspace.PlayerModel
savebtn.MouseButton1Down:Connect(function()
click:Play()
applyCharDetailEvent:FireServer(char)
end)
server script
applyCharDetailEvent.OnServerEvent:Connect(function(player, char)
-- checks n stuff here to prevent exploiters
-- THIS SECTIONIS PURELY JUST TO APPLY THE ACCESSORIES AND REMOVE THE OLD ONES
for c,x in ipairs(player.Character:GetChildren()) do
if x and x:IsA("Accessory") then
x:Destroy()
end
end
for c,x in ipairs(player.Character.Head:GetChildren()) do
if x and x:IsA("Accessory") then
x:Destroy()
end
end
for c,x in ipairs(player.Character.UpperTorso:GetChildren()) do
if x and x:IsA("Accessory") then
x:Destroy()
end
end
for i,v in ipairs(char:GetChildren()) do
if v and v:IsA("Acessory") then
local new = v:Clone()
addAccoutrement(player.Character,new)
end
end
for i,v in ipairs(char.Head:GetChildren()) do
if v and v:IsA("Acessory") then
local new = v:Clone()
addAccoutrement(player.Character.Head,new)
end
end
for i,v in ipairs(char.UpperTorso:GetChildren()) do
if v and v:IsA("Acessory") then
local new = v:Clone()
addAccoutrement(player.Character.UpperTorso,new)
end
end
local bodyColor2=workspace[player.Name]['Body Colors']
local bodyColors = char["Body Colors"]
if bodyColor2 then
bodyColor2.HeadColor3 = bodyColors.HeadColor3
bodyColor2.LeftArmColor3 = bodyColors.LeftArmColor3
bodyColor2.LeftLegColor3 = bodyColors.LeftLegColor3
bodyColor2.RightArmColor3 = bodyColors.RightArmColor3
bodyColor2.RightLegColor3 = bodyColors.RightLegColor3
bodyColor2.TorsoColor3 = bodyColors.TorsoColor3
else
print("ERROR: Unable to find the players body colors; AvatarMenuHandler")
end
local shirt = char.Shirt.ShirtTemplate
local pants= char.Pants.PantsTemplate
player.Character:WaitForChild("Shirt").ShirtTemplate=shirt
player.Character:WaitForChild("Pants").PantsTemplate=pants
end)
This code is functional and runs with error, but it actually displays the server’s version of char.
Server Player Model looks like this:
https://gyazo.com/7d28f8c62d8ab24d93975d42cff3c9cb
Player looks like this
https://gyazo.com/86ae60397ff87212f7d3927b6c6ad0a4
Player Should look like this:
https://gyazo.com/8f64fa0103d0397708faa4ed54edd378
So, How would I pass the right version(the clients version) of this model in the remote event? Or should I do it a separate way?