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

make droppers spawn custom models ?

Asked by 3 years ago

hi i am new to creating roblox games and i wanted to do a tycoon, but droppers will spawn custom models so i found this script to spawn bricks but i want to change it to models that i have in my map

 function fire()
        local p = Instance.new("Part")
        p.Position = script.Parent.Position
        p.Size = Vector3.new(1,1,1)
        p.BrickColor = BrickColor.new(26)
        p.BottomSurface = 0
        p.TopSurface = 0
        p.Name = "Part"
        p.Parent = script.Parent
end 


while true do 
     wait(2)
     fire()
end 

can someone edit the script and give me one that works plz ?

2 answers

Log in to vote
0
Answered by 3 years ago

Not going to edit it for you, but a way to do this would be to make sure that you have set the PrimaryPart of a model (in properties), then something along the lines of..

local model = game:GetService("ServerStorage").path.to.model:Clone() model:SetPrimaryPartCFrame(path.to.spawn.position)

instead of the whole Instance.new() (and then modifying the instances properties)

0
yeah but where do i put the model's name ? Abdelmoulak 0 — 3y
0
@Abdelmoulak It's not about putting the models name somewhere, it's about writing to the location of the model. I do not know where you have stored the model. centraltrains 60 — 3y
0
it's in tthe explorer what am i sopposed to do to know the paht Abdelmoulak 0 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

Just write the following code:

function fire() --Define the function
    local model = game.Workspace.ModelName -- Define where the model is placed
    local modelClone = model:Clone() -- Makes a duplicate of the model
end

while true do -- In a constant loop
    fire() -- The function runs cloning the model every 1 second
    wait(1) -- Waits 1 second before going to the top and firing the function again!
end

Hopefully this helped!

0
thanx man Abdelmoulak 0 — 3y
0
hi i just put it into my game and it didn't work, so i changed the "ModelName" to the name of my model but nothing spawned, am i supposed tu put the script on the part where i want it to spawn , right ? Abdelmoulak 0 — 3y
0
So you can put the script in serverscript service and you have to define where the model is. For example, if it is in the workspace, then you say game.Workspace.ModelName or if it is in replicated storage, then you say game.ReplicatedStorage.ModelName Lightning_Game27 232 — 3y
0
So you can put the script in serverscript service and you have to define where the model is. For example, if it is in the workspace, then you say game.Workspace.ModelName or if it is in replicated storage, then you say game.ReplicatedStorage.ModelName Lightning_Game27 232 — 3y

Answer this question