Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i spawn a model in a specific position?

Asked by 4 years ago

How do i spawn a model in a specific position?

2 answers

Log in to vote
1
Answered by
DanzLua 2879 Moderation Voter Community Moderator
4 years ago

Lets use the :SetPrimaryPartCFrame() function to move the models

First make sure your model has a PrimaryPart set

Before you set the model's parent, use the function to set its position

local model=model
local position=Vector3.new(0,0,0)

--setprimarypartcframe take a cframe value which is applied to the model's primarypart
--the other parts are moved along with the primarypart
model:SetPrimaryPartCFrame(CFrame.new(position))

--spawn it
model.Parent=workspace
0
good InsidiousRanger 13 — 4y
0
Thank You! GodlyEricGamer1800 -100 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Let's just pretend you want when a player touches or click a part, it spawns the part in that position? In this case we'd have to Clone it from ServerStoarge Do this: Place the block in that exact position and move it into ServerStorage Add a script to the block you want the player to touch or to click Write (for touching that part)

function(onTouched)

or for clicking a part (Use a click detector)

script.Parent.ClickDetector.MouseClick:connect(function(mouse)

Then add this script : ~~~~~~~~~~~~~~~~~ local storage = game:GetService("ServerStorage") local part = storage["Part"]:Clone() -- Change "Part" to the part name. part.Parent = game.Workspace ~~~~~~~~~~~~~~~~~ If you have any question, feel free to ask me!

0
Thank You! GodlyEricGamer1800 -100 — 4y

Answer this question