i want to make it where after the player loads into the new model they will have a textbutton asking fi they would like to revert to there old avatar however i cant seem to get this to work so i came here for help. (this is on a server script.)
local changed = false
player:LoadCharacter(newchar)
if changed == false then
changed = true
newspawn:Destroy()
local Humanoid = player.Character:WaitForChild("Humanoid")
remote:FireClient(player)
create1:Play()
create2:Play()
CFloop.Position = player.Character.HumanoidRootPart.Position
wait(0.5)
CFloop:Destroy()
player.RespawnLocation = nil
local Revert = game.StarterGui.Reverter.RevertButton
local screengui = Revert.Parent
if changed == true then
screengui.Enabled = true
end
Revert.Activated:Connect(function()
player:LoadCharacter(oldchar)
end)
end
end
remote.OnServerEvent:Connect(ChangeCharacter)
i think im already doing this with the remote event if this helps heres my local script and the rest of my sever script Local script\
local tool = script.Parent
local debounce = false
tool.Activated:Connect(function(click)
local player = game.Players.LocalPlayer
local remote = game.ReplicatedStorage.Change
remote:FireServer()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)
end)
ALL of my server script
local remote = game.ReplicatedStorage.Change
local debounce = false
local function ChangeCharacter(player)
local oldchar = player.Character:Clone()
local newchar = game.Workspace.rimuru:Clone()
newchar.Name = "StarterCharacter"
newchar.Parent = game.StarterPlayer
newchar.PrimaryPart = newchar:WaitForChild("HumanoidRootPart")
newchar:WaitForChild("Humanoid").HipHeight = 0
local floop = game.Workspace.Shockwave
local CFloop = floop:Clone()
CFloop.Parent = floop.Parent
local tweenservice = game:GetService("TweenService")
local Canuse = true
local info = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local goal = {
Size = Vector3.new(83.865, 4.9, 83.865)
}
local create1 = tweenservice:Create(CFloop, info, goal)
--tweening to make transparent
local info = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local goal = {
Transparency = 1
}
local create2 = tweenservice:Create(CFloop, info, goal)
local newspawn = Instance.new("SpawnLocation", game.Workspace)
newspawn.Transparency = 0
newspawn.CanCollide = false
newspawn.Position = player.Character.HumanoidRootPart.Position
player.RespawnLocation = newspawn
local changed = false
player:LoadCharacter(newchar)
if changed == false then
changed = true
newspawn:Destroy()
local Humanoid = player.Character:WaitForChild("Humanoid")
remote:FireClient(player)
create1:Play()
create2:Play()
CFloop.Position = player.Character.HumanoidRootPart.Position
wait(0.5)
CFloop:Destroy()
player.RespawnLocation = nil
local Revert = game.StarterGui.Reverter.RevertButton
local screengui = Revert.Parent
if changed == true then
screengui.Enabled = true
end
Revert.Activated:Connect(function()
player:LoadCharacter(oldchar)
end)
end
end
remote.OnServerEvent:Connect(ChangeCharacter)