Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

make droppers spawn custom models ?

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

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)

3 comments

0

yeah but where do i put the model's name ?

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.

0

it's in tthe explorer what am i sopposed to do to know the paht

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!

4 comments

0

thanx man

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 ?

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.