So, I was playing around with changing a player's appearance via CharacterAppearance and I've stumbled upon an issue. It works perfectly fine in studio, but it doesn't want to work in-game. Tried multiple different things, but nothing seems to work. It's been FE'd, so I honestly don't know what the issue is. Here's what I've got:
Server Script:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local ChangeEvent = ReplicatedStorage:WaitForChild("ChangeEvent") local Players = game:GetService("Players") local function changed(plr) plr.CharacterAppearance = "http://www.roblox.com/Asset/CharacterFetch.ashx?userId=1" local Pos = plr.Character:GetPrimaryPartCFrame() plr:LoadCharacter() plr.Character:SetPrimaryPartCFrame(Pos) print("Changed") end ChangeEvent.OnServerEvent:Connect(changed)
Local Script:
local UserInputService = game:GetService("UserInputService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local Event = ReplicatedStorage:WaitForChild("ChangeEvent") local function change(inputObject, gameProcessed) if inputObject.KeyCode == Enum.KeyCode.E then Event:FireServer() print("Key Pressed") end end UserInputService.InputBegan:Connect(change)
So, the "CharacterAppearance" property is deprecated. Try using "CharacterAppearanceId" instead. Not only is it easier, but it may solve your issue. I've fixed up the server script with CharacterAppearanceId, and I've also compiled your functions in both of the scripts by connecting it with the argument which I personally find a little more efficient than having all the connections at the bottom of the script. Lastly, in the sever script you had a "Players" variable that was not needed by anything within the script, so I just removed that as well.
Server script:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local ChangeEvent = ReplicatedStorage:WaitForChild("ChangeEvent") ChangeEvent.OnServerEvent:Connect(function(plr)) plr.CharacterAppearanceId = 1 -- The number 1 is the user ID local Pos = plr.Character:GetPrimaryPartCFrame() plr:LoadCharacter() plr.Character:SetPrimaryPartCFrame(Pos) print("Changed") end
Local script:
local UserInputService = game:GetService("UserInputService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local Event = ReplicatedStorage:WaitForChild("ChangeEvent") UserInputService.InputBegan:Connect(function(inputObject, gameProcessed)) if inputObject.KeyCode == Enum.KeyCode.E then Event:FireServer() print("Key Pressed") end end