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

How can i make a button that spawns a bomb where a part is?

local Summon = game.ServerStorage.Bomb
local function CreateSummonCopy()
	local SummonCopy = Summon:Clone()
	SummonCopy.Parent = game.Workspace
end

script.Parent.ClickDetector.MouseClick:Connect(function()
	CreateSummonCopy()
end)

i have done so it spawns at the place where it was inserted before getting in serverstorage but i want it to spawn where a part is because the bomb should spawn underneat a moving object

1 answer

You can change it's Position with the other part's position.

And this is how you use it:

local Summon = game.ServerStorage.Bomb
local otherpart -- type here the part's location in your game that you want to bomb to spawn in.

local function CreateSummonCopy()
    local SummonCopy = Summon:Clone()
    SummonCopy.Parent = game.Workspace
    SummonCopy.Position = otherpart.Position
end

script.Parent.ClickDetector.MouseClick:Connect(function()
    CreateSummonCopy()
end)

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