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

How can i fix the explosion position?

Asked by 3 years ago
usi = game:GetService("UserInputService")
plr = game.Players.LocalPlayer
char = plr.Character
debris = game:GetService("Debris")

usi.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.X then
        animation = Instance.new("Animation")
        animation.AnimationId = "rbxassetid://7050119585"
        animation.Parent = plr
                debris:AddItem(animation,2)

        load = game.Workspace[game.Players.LocalPlayer.Name].Humanoid:LoadAnimation(animation):Play()

        wait(.15)


        explosion = Instance.new("Explosion")
        explosion.Parent = workspace
        explosion.DestroyJointRadiusPercent = 0
        explosion.Position = game.Players.LocalPlayer.Character.RightHand.Position + (Vector3.new(50,0,0) * game.Players.LocalPlayer.Character.RightHand.CFrame.LookVector)
    end

end)

Im trying to make a explosion appear in front of player's hand when he press x. But almost everytime the explosion goes another way (i dont think this problem is because of the animation).

1 answer

Log in to vote
0
Answered by 3 years ago

ok i fixed it : explosion.Position = plr.Character.HumanoidRootPart.Position + (plr.Character.HumanoidRootPart.CFrame.LookVector*Vector3.new(10,10,10))

Ad

Answer this question