Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i modify a model (That was spawned by a script) with a script?

How do i modify a model (That was spawned by a script) with a script?

3 comments

0

Please someone help me, i really need to know this to make my game.

0

Can you show us code?

0

I don't have access to my computer right now, and i'm using my phone. Could you just make a code with an explanation?

1 answer

✓ Accepted answer

If you are talking about its properties, there are only 3 important ones, the name, its primarypart, and its location.

Changing its name is simple

model.Name="whatever"

changing its primarypart requires a part inside it

model.PrimaryPart=model.Part

As for its location we use :SetPrimaryPartCFrame() which requires a primarypart

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))

4 comments

0

How do i set a Primary Part?

0

@GodlyEricGamer1800 either through the explorer/properties windows in studio or through a script like above. more info: https://developer.roblox.com/api-reference/property/Model/PrimaryPart

0

Is it possible to change the model's color?

0

@GodlyEricGamer1800 Models don't have a color property. If you're talking about the parts inside the model then you could create a for loop and go through each BasePart and change its color

This discussion is preserved as it was. New answers, comments, and votes are closed.