-
I want to keep the character after Respawn/Death
-
I heard about that i should try with DataStore but idk how to script it
-
How does it work with DataStore, Do u have other Solutions
following script it that one for changing the Character
local Characters = game.ReplicatedStorage:WaitForChild("Characters")
script.Parent.MouseButton1Click:Connect(function(player, chosenCharacter)
-- Setze chosenCharacter fest auf "Rubixcube"
chosenCharacter = "Rubixcube"
if Characters:FindFirstChild(chosenCharacter) then
local newChar = Characters:FindFirstChild(chosenCharacter):Clone()
local plrChar = script.Parent.Parent.Parent.Parent.Parent.Character
newChar.PrimaryPart = newChar.Torso
newChar:SetPrimaryPartCFrame(plrChar.PrimaryPart.CFrame)
newChar.Name = script.Parent.Parent.Parent.Parent.Parent.Name
if plrChar:FindFirstChild("Animate") and not newChar:FindFirstChild("Animate") then
plrChar.Animate:Clone().Parent = newChar
end
if plrChar:FindFirstChild("Health") and not newChar:FindFirstChild("Health") then
plrChar.Health:Clone().Parent = newChar
end
script.Parent.Parent.Parent.Parent.Parent.Character = newChar
local rootPart = newChar:FindFirstChild("HumanoidRootPart")
local plrRoot = script.Parent.Parent.Parent.Parent.Parent.Character:FindFirstChild("Torso")
if rootPart and plrRoot then
rootPart.CFrame = plrRoot.CFrame
end
newChar.Parent = game.Workspace
for i, part in pairs(newChar:GetDescendants()) do
if part:IsA("BasePart") then
part.Anchored = false
end
end
end
end)