✓ Accepted answer
Archivable property
All instances have an Archivable property. This determines if an object can be cloned, or saved
By default roblox characters have this set to false and when you try cloning without setting it to true, instance.Clone will return nil.
Also your script has lots of "fluff", lots of what you are doing is redundant.
ds is a misleading variable name, it does not clearly show its purpose in the code. character was one of your variables but you never used it.
What you can do is something like this:
local button = script.Parent;
local client = game:GetService("Players").LocalPlayer;
local character = client.Character or client.CharacterAdded:Wait();
character.Archivable = true;
button.Activated:Connect(function()
local clone = character:Clone();
clone:SetPrimaryPartCFrame(character.HumanoidRootPart.CFrame));
end);
There is no point in multiplying it by CFrame.new(0, 0, 0). It won't do anything.
Finally, please, please, please indent. Separating each statement with a line of whitespace is not a substitute for indenting properly and doesn't make the code any more readable.
If indenting is truly hard for you, I have made a tutorial which covers when and when not to indent. You can find it here.
I hope I helped you, and if I did, then don't forget to hit that "Accept Answer" button. It helps the both of us out.
1 comment
You should actually do character:Clone() instead of ds:Clone(). "ds" and "character" are actually the same exact thing.