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

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

Asked by 5 years ago

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

0
Please someone help me, i really need to know this to make my game. GodlyEricGamer1800 -100 — 5y
0
Can you show us code? Prestory 1395 — 5y
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? GodlyEricGamer1800 -100 — 5y

1 answer

Log in to vote
0
Answered by
DanzLua 2879 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

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))
0
How do i set a Primary Part? GodlyEricGamer1800 -100 — 5y
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 DanzLua 2879 — 5y
0
Is it possible to change the model's color? GodlyEricGamer1800 -100 — 5y
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 DanzLua 2879 — 5y
Ad

Answer this question