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

01function fire()
02        local p = Instance.new("Part")
03        p.Position = script.Parent.Position
04        p.Size = Vector3.new(1,1,1)
05        p.BrickColor = BrickColor.new(26)
06        p.BottomSurface = 0
07        p.TopSurface = 0
08        p.Name = "Part"
09        p.Parent = script.Parent
10end
11 
12 
13while true do
14     wait(2)
15     fire()
16end

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

2 answers

Log in to vote
0
Answered by 4 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 — 4y
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 — 4y
0
it's in tthe explorer what am i sopposed to do to know the paht Abdelmoulak 0 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

Just write the following code:

1function fire() --Define the function
2    local model = game.Workspace.ModelName -- Define where the model is placed
3    local modelClone = model:Clone() -- Makes a duplicate of the model
4end
5 
6while true do -- In a constant loop
7    fire() -- The function runs cloning the model every 1 second
8    wait(1) -- Waits 1 second before going to the top and firing the function again!
9end

Hopefully this helped!

0
thanx man Abdelmoulak 0 — 4y
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 — 4y
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 — 4y
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 — 4y

Answer this question