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
8 years ago

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

Log in to vote
1
Answered by
DevSean 270 Moderation Voter
8 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.

bomb.Position = player.Character.Torso.Position
Ad
Log in to vote
0
Answered by 8 years ago
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)

Answer this question