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
01 | function fire() |
02 | local p = Instance.new( "Part" ) |
03 | p.Position = script.Parent.Position |
04 | p.Size = Vector 3. 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 |
10 | end |
11 |
12 |
13 | while true do |
14 | wait( 2 ) |
15 | fire() |
16 | end |
can someone edit the script and give me one that works plz ?
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)
Just write the following code:
1 | function 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 |
4 | end |
5 |
6 | while 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! |
9 | end |
Hopefully this helped!