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

Why isn't this explosion script working?

So I made an explosion script based off of a dialog choice..

Dialog=script.Parent
Dialog.DialogChoiceSelected:connect(function(Player, Choice)
if Choice == Dialog.DialogChoice1.DialogChoice2.DialogChoice3 then
local bomb = Instance.new("Explosion",game.Workspace)
bomb.Position = game.Workspace.Player.Torso
end
end)

so why doesn't it work? Instead of blowing up the my torso, it just goes in some other spot in the map..

2 answers

✓ Accepted answer

You need to set the position to the torso's position, for example:

If we use the player returned from DialogChoiceSelectedwe know which Player chose the dialog, we can then get the Character from the Player and position the Explosion to the Character's Torso.

bomb.Position = player.Character.Torso.Position
Dialog=script.Parent
Dialog.DialogChoiceSelected:connect(function(Player, Choice)
if Choice == Dialog.DialogChoice1.DialogChoice2.DialogChoice3 then
local bomb = Instance.new("Explosion",game.Workspace)
bomb.Position = game.Workspace.Player.Torso.Position
end
end)

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