Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can a player keep the changes made to his character even after he resets?

Asked by
Zologo 37
5 years ago

So I have this script which makes the LocalPlayer's character go blank

game.Players.PlayerAdded:connect(function(player)
    player.CanLoadCharacterAppearance = false
end)

After that when the player clicks a button it triggers a remote event that changes the player's character's clothing and body colors.

This is the remote Event script in the button

local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function(player)

    game.ReplicatedStorage.RemoteNaruto:FireServer()

    script:FindFirstAncestor('Starters'):Destroy()

end)

Which triggers this

game.ReplicatedStorage.RemoteNaruto.OnServerEvent:Connect(function(player)

local rp = game.ReplicatedStorage
 local naruto = rp:WaitForChild('Naruto')
local x = player.Character 


    for name, child in pairs(x:GetChildren()) do -- Looping through all of the children
    if child:IsA("BasePart") then -- Checking if it's a part
        child.BrickColor = BrickColor.new('Pastel brown') -- Setting it to pastel
    end
    end


    --Clothing
   local shirt = Instance.new('Shirt',x)
   local pants = Instance.new('Pants' ,x)

    pants.PantsTemplate="http://www.roblox.com/asset/?id=1023408267"--changes pants id


    shirt.ShirtTemplate="http://www.roblox.com/asset/?id=817261375"--changes pants id

    --remove face
    x.Head.face:Destroy()

    player.PlayerGui.Starters:Destroy()




end)

The remote event works but when the player decides to reset or dies and has to respawn he looses the changes made to the character and goes back to the blank character from the first script.

Can Anyone Help me, Please?

Answer this question