So my task is to make sure that when you click on the left mouse button playing an animation of how player throws dynamite forward. I have already made clicking the left mouse button to play the animation, but I have a problem. Dynamite flies to the wrong place, that’s what it does:
Here’s how I did it. This is where the dynamite lies:
And here is the script itself and where it lies:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local bombModel = game:GetService("ReplicatedStorage")["TNT STICK"]
local explosionAnimation = game:GetService("ReplicatedStorage").Throwing
local motor6D = game:GetService("ReplicatedStorage").Motor6D
local function throwBomb()
local Humanoid = player.Character:WaitForChild("Humanoid")
local Animator = Humanoid:FindFirstChildOfClass("Animator")
if Animator then
local clone = bombModel:Clone()
clone.Parent = player.Character.RightHand
motor6D.Parent = player.Character.RightHand
motor6D.Part0 = player.Character.RightHand
motor6D.Part1 = player.Character.RightHand["TNT STICK"].Circle
local animation = Animator:LoadAnimation(explosionAnimation)
animation:Play()
clone.Active.Value = true
wait(1.5)
motor6D.Parent = game:GetService("ReplicatedStorage")
clone:Destroy()
game:GetService("ReplicatedStorage")["TNT STICK"].Active.Value = false
end
end
So again, the problem is to make the dynamite fly forward instead of upwards. And the second task is to make it so that when it lands or touches the desk, it explodes
So in my animation it flies, but there it flies forward, but when I check it in reality, it flies upwards for some reason