Hi, I just started learning so please bear with me. I'm trying to clone a model called Test562 from the ServerStorage and from touching a part.
part = script.Parent part.Touched:Connect(function() local test2 = game.ServerStorage.Test562 test2.Parent = game.Workspace end)``
And if you guys can tell me how I can place the model to a specific position, that would be amazing.``
To make a copy of any instance with Archivable
set to true
, use Clone()
.
If you also want to position the model, use SetPrimaryPartCFrame()
. (You have to set the PrimaryPart
first because the PrimaryPart
is nil by default.) Example:
local part = script.Parent -- Please use local variables local debounce = true part.Touched:Connect(function() if debounce == false then return end debounce = false if game:GetService("ServerStorage"):FindFirstChild("Test562") then local test = game:GetService("ServerStorage").Test562:Clone() test.Parent = workspace if test.PrimaryPart == nil then test.PrimaryPart = test.Core -- Assign the primary part first. Core is just an example of a child. end test:SetPrimaryPartCFrame(CFrame.new(Vector3.new(1,1,1))) end wait(3) debounce = true end)