Hello everyone!
Today I’ve been trying to make a throw script for a ball, but for some reason, it doesn’t want to work. I’ve tried functions as well but couldn’t get them to work either. Right now I’m just trying to get the animations playing and have the output say what I’m doing.
Heres the script:
local tool = script.Parent
local char = tool.Parent
local plr = game:GetService("Players").LocalPlayer
local mouse = plr:GetMouse()
local pwr = 0
local hold = false
local track1 = nil
local track2 = nil
local holdanim = tool.Handle.Hold
local throwanim = tool.Handle.Throw
mouse.Button1Down:Connect(function()
hold = true
end)
mouse.Button1Up:Connect(function()
hold = false
end)
local function throw()
end
if hold then
track1 = char.Humanoid:LoadAnimation(holdanim)
track1:Play()
while hold do
pwr += 1
wait(0.02)
end
else
warn("Throw at: "..pwr)
track1:Stop()
track2 = char.Humanoid:LoadAnimation(throwanim)
track2:Play()
throw()
end
(P.S. I don’t want to have a warn for every single time the power goes up because I don’t want to overload the output)