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?
1 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
How do i set a Primary Part?
@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
Is it possible to change the model's color?
@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.

3 comments
Please someone help me, i really need to know this to make my game.
Can you show us code?
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?