How to make a clone by using
For i ,v in pairs(char:GetChildren)
How to make a clone by using
For i ,v in pairs(char:GetChildren)
I donβt thing you need to get the children of a character, I just think you need to just get the character itself, and clone that. That will clone all of the children too.
As for making it happen when pressing the 1 key, take a look at this:
https://developer.roblox.com/en-us/api-reference/class/ContextActionService
Iβm assuming you mean the literal β1β key so, you should use UserInputService and Enum.KeyCode (You will need a remote event, server script, and a local script).
--local
local UIS = game:GetService("UserInputService")
local Event = --event here
UIS.InputBegan:Connect(function(key, typing) --runs when keys are pressed
if not typing and key.KeyCode == Enum.KeyCode.One then --check if processed and is the "1" key
Event:FireServer() --fire the event
end
end)
--Server
local Event = --Event
Event.OnServerEvent:Connect(function(plr)
if plr.Character then --checks if the character exists
plr.Character:Clone() --clone the character
end
end)