Script:
local db = false
local direction
local debris = game:GetService("Debris")
script.Parent.Throwing.OnServerEvent:Connect(function(player, mouseOp)
direction = mouseOp
end)
script.Parent.Activated:Connect(function()
if not db then
db = true
--Play animation
local humanoid = script.Parent.Parent:FindFirstChild("Humanoid")
local ThrowAnim = humanoid:LoadAnimation(script.Throw)
ThrowAnim:Play()
wait(0.5)
-- Throw the TNT
print("throwing")
script.Parent.Handle.Transparency = 1
local tntClone = script.Parent.Handle:Clone()
tntClone.CFrame = CFrame.new(script.Parent.Handle.Position + script.Parent.Handle.CFrame.LookVector * 3, direction)
--BodyVelocity
print("Throw")
local bv = Instance.new("BodyVelocity")
bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bv.P = 3000
local ori = 0
spawn(function()
while wait() do
ori = ori - 0.1
tntClone.CFrame = tntClone.CFrame + tntClone.CFrame.LookVector * 4
tntClone.Orientation = Vector3.new(tntClone.Orientation.X + ori, tntClone.Orientation.Y, tntClone.Orientation.Z)
print("position")
end
end)
-- Touch function for the ball
tntClone.Touched:Connect(function(hit)
print("destroy")
--tntClone:Destroy()
-- Effects
end)
end
end)
Local Script:
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
script.Parent.Activated:Connect(function()
script.Parent.Throwing:FireServer(mouse.Hit.p)
print(mouse.Hit.p)
end)
So I have a script for throwing dynamite, except that the problem is that when I throw it happens this situation:
This is what it says in output:
Question why I have dynamite disappears and does not get into the check touched? That is, it is sort of thrown, but then disappears, why?