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

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

Asked by 3 years ago
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

Log in to vote
0
Answered by 3 years ago

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)
Ad

Answer this question