#Reset Avatar Code
17 messages · Page 1 of 1 (latest)
put this into ur localscript:
local button = script.Parent
button.MouseButton1Click:Connect(function()
game.ReplicatedStorage:WaitForChild("RefreshAvatarEvent"):FireServer()
end)
Make a RemoteEvent in ReplicatedStorage called "RefreshAvatarEvent"
and make a script in ServerScriptService and enter this script:
local refreshEvent = game.ReplicatedStorage:WaitForChild("RefreshAvatarEvent")
local function refreshAvatar(player)
local char = player.Character
if char then
player:LoadCharacter()
end
end
refreshEvent.OnServerEvent:Connect(refreshAvatar)
beat me to it
also put player.CharacterAppearanceId = player.UserId above player:LoadCharacter()
thats meant to happen but to make it go back to where you were its more complex
u want the character to stay at the current position?
** You are now Level 4! **
local refreshEvent = game.ReplicatedStorage:WaitForChild("RefreshAvatarEvent")
local function refreshAvatar(player)
local character = player.Character
if character then
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if humanoidRootPart then
local originalPosition = humanoidRootPart.Position
local originalOrientation = humanoidRootPart.Orientation
player:LoadCharacter()
local newCharacter = player.Character or player.CharacterAdded:Wait()
local newHumanoidRootPart = newCharacter:WaitForChild("HumanoidRootPart")
newHumanoidRootPart.CFrame = CFrame.new(originalPosition) * CFrame.Angles(math.rad(originalOrientation.X), math.rad(originalOrientation.Y), math.rad(originalOrientation.Z))
end
end
end
refreshEvent.OnServerEvent:Connect(refreshAvatar)
** You are now Level 1! **