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

How do i make a tool that spawns a model ONCE only and then deletes itself?

Asked by 7 years ago

i made a model spawner but it spawns infinite copies as long as you click.i want a tool that spawns the model once and then deletes itself.heres what i have:

bin = .Parent

function onButton1Down(mouse)

local model = bin.Model:clone() --Change "Plane" to What Ever Model Name You Have

model.Parent = game.Workspace
    model:MakeJoints()
model:MoveTo(mouse.hit.p)

end

function onSelected(mouse) mouse.Icon = "rbxasset://textures\GunCursor.png" mouse.Button1Down:connect(function() onButton1Down(mouse) end) end

bin.Selected:connect(onSelected)

0
What exactly do you want removed? superhudhayfa 39 — 7y
0
the tool,after placing the model Chinchilliday -5 — 7y

1 answer

Log in to vote
0
Answered by
Uzuntu 6
7 years ago

Try putting it in an if then statement. This way, if the mouse is clicked, it'll spawn the model, then delete itself.

http://wiki.roblox.com/index.php?title=Conditional_statement

0
sorry this doesnt make sense to me.Can you show me how you would make the tool delete itself?I do understand if it is used in a shop or inventory script. Chinchilliday -5 — 7y
Ad

Answer this question