I made an throw script inside the rambo knife
there the throw script :
local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local tool = script.Parent
repeat wait() until game.Players.LocalPlayer.Character
char = game.Players.LocalPlayer.Character
local hum = char:FindFirstChild("Humanoid")
local Toss = hum:LoadAnimation(script.Parent.Animations.Toss)
local Throw = hum:LoadAnimation(script.Parent.Animations.Throw)
local TossPlaying = tool:WaitForChild("TossPlaying")
local mouse = player:GetMouse()
local z = tool.Handle:Clone()
local SP = script.SP:Clone()
ready = false
UIS.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if ready == false then
delay(1, function()
Toss:Play()
TossPlaying.Value = true
ready = true
end)
end
end
end)
UIS.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if ready == true then
script.Disabled = true
Toss:Stop()
Throw:Play()
tool.Handle.Throw:Play()
TossPlaying.Value = false
local Projectile = z:Clone()
local BV = Instance.new("BodyVelocity")
local BAV = Instance.new("BodyAngularVelocity")
local h = mouse.Hit
Projectile.Parent = game.Workspace
Projectile.CFrame = player.Character.Torso.CFrame*CFrame.new(math.random(-2,2),math.random(-1,1),-3)
Projectile.CFrame = CFrame.new(Projectile.Position,mouse.hit.p)
BV.Parent = Projectile
BV.velocity = Projectile.CFrame.lookVector*135
BV.maxForce = Vector3.new(math.huge,math.huge,math.huge)
BAV.AngularVelocity = Vector3.new(15,15,15)
BAV.MaxTorque = Vector3.new(4000,4000,4000)
SP.Parent = Projectile
SP.Disabled = false
tool.Handle.Transparency = 1
tool.Server.Disabled = true
tool.Client.Disabled = true
wait(5)
tool.Handle.Transparency = 0
tool.Server.Disabled = false
tool.Client.Disabled = false
ready = false
script.Disabled = false
end
end
end)
A script named "SP" inside the throwscript
script.Parent.Touched:Connect(function(hit)
local check = hit.Parent:FindFirstChildOfClass("Humanoid")
if check then
local knock = Instance.new("BodyVelocity")
local hitsound = Instance.new("Sound", script.Parent)
hitsound:Play()
hitsound.SoundId = "rbxassetid://591409134"
hitsound.Volume = 1
check:TakeDamage(100)
knock.Parent = hit.Parent.Torso
knock.maxForce = Vector3.new(math.huge,math.huge,math.huge)
knock.velocity = script.Parent.CFrame.lookVector*135
script.Parent.Anchored = true
script.Parent.CanCollide = false
wait(5)
knock:Destroy()
script.Disabled = false
end
end)
i want it work correctly
I need like when u hold the left mouse button it toss when up the button it throws, but mine works like: clicked = toss, click again = throw

1 comment
Everything works, but when i just click toss animation plays, but everything works,