I’m trying to make it so when you activate a tool an object is thrown. For this, I am using body velocity. However, the function to actually throw the object is not being called. I tried to use tool.Activated, but to no avail.
make sure that the manualactivationonly property is disabled on the tool.
if it’s disabled, try activating the tool manually using tool:Activate() to see if it is an error in your code or not
Don’t use deprecated Instances in your work. Let that be a heads-up, by the way.
If you’re trying to make a Tool that can be thrown by click, it’s much more easier than you think. You can just create a tool with no handle, (Make sure to set the RequiresHandle property to false.), and put a little script inside that looks something like this:
local DS = game:GetService("Debris")
local tool = script.Parent
local throwSpeed = 100
tool.Activated:Connect(function()
local player = game.Players:FindFirstChild(tool.Parent.Parent.Name) or game.Players:GetPlayerFromCharacter(tool.Parent)
local part = Instance.new("Part", workspace)
part.Size = Vector3.new(1,1,1)
part.Shape = Enum.PartType.Ball
part.Position = player.Character.HumanoidRootPart.CFrame + (player.Character.HumanoidRootPart.CFrame.LookVector*3)
part.AssemblyLinearVelocity = player.Character.HumanoidRootPart.CFrame.LookVector * throwSpeed
DS:AddItem(part,5)
end)
Might look a bit messy, but just try it. It might work.