You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to switch the player character
What is the issue? Include screenshots / videos if possible!
all of the ui gets deleted including scripts once the character is switched >:(
What solutions have you tried so far? Did you look for solutions on the Creator Hub?
changind a few things, looking in the dev hub, but nothing mentions this bug
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local char = game.Players.LocalPlayer.Character
local charClone = game.ReplicatedStorage.charFolder:FindFirstChild(selectedChar["charName"])
local oldChar = plr.Character
charClone.Parent = workspace
charClone.Name = plr.Name
plr.Character = charClone
char = charClone
workspace.CurrentCamera.CameraSubject = plr.Character:FindFirstChild("Humanoid")
oldChar:Destroy()
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
the character isnt set to the original character’s position, and everything inside playerGui is deleted exept for the freecam ui (default roblox cam ui) even thou i didnt delete anything related to UI during switch
update: managed to get the character to go to position using a simple :pivotTo() command, and the character moves and stuff, but the UI is still deleted and i dont get why
update2: once i switch the character variable in the player instance, the ui gets deleted
no i didnt and also:
managed to get the character to go to position using a simple :pivotTo() command, and the character moves and stuff, but the UI is still deleted and i dont get why
and i found out that:
once i switch the character variable in the player instance, the ui gets deleted
--Player model
local player = game:GetService("Players") -- insert the specific player
--table
local stuff = {}
--Before changing
for _,v in pairs(player.PlayerGUI:GetChildren()) do
local newGUI = v:Clone()
table.insert(stuff,newGUI)
v:Destroy()
end
--INSERT CHANGING CHARACTER CODE HERE
--when its done
for _,v in pairs(stuff) do
local newGUI = v:Clone()
table.insert(stuff,newGUI)
v.Parent = player.PlayerGUI
end
What this does is basically store the gui in a table, then reinserting it into the player’s player gui
i found out by asking the roblox AI that when switching the player.character variable, it completely deletes all UI associated with that character for some reason