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

Why isn't this explosion script working?

Asked by
EpicLilC 150
9 years ago

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

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

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

Log in to vote
1
Answered by
DevSean 270 Moderation Voter
9 years ago

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.

1bomb.Position = player.Character.Torso.Position
Ad
Log in to vote
0
Answered by 9 years ago
1Dialog=script.Parent
2Dialog.DialogChoiceSelected:connect(function(Player, Choice)
3if Choice == Dialog.DialogChoice1.DialogChoice2.DialogChoice3 then
4local bomb = Instance.new("Explosion",game.Workspace)
5bomb.Position = game.Workspace.Player.Torso.Position
6end
7end)

Answer this question