So I tried every single method for using my animation. Maybe this is roblox maintenance, but other scripts work perfectly.
I tried: waiting for the character’s parent, waiting for the character to be added, waiting for the character’s ancestry to be changed, and I tried waiting 5 seconds just to see if it would somehow wait long enough for the character to be a descendant but nope it’s still not working…
Here’s the Code I’m using currently:
local Tool = script.Parent
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
if not Character.Parent then
Character.AncestryChanged:Wait()
end
local cantClick = false
local Hum = Character:WaitForChild("Humanoid")
local Animator = Hum:WaitForChild("Animator", 10000)
local Root = Character:WaitForChild("HumanoidRootPart")
local UIS = game:GetService("UserInputService")
local unequippedduringhold = false
local Attack = 1
local LastClick
local mod = require(script:WaitForChild("Mod"))
local holding = false
local equipped
function hold()
if not LastClick then
LastClick = tick()
else
if tick() > LastClick + 3 then
Attack = 1
end
end
local Track
if Attack == 1 then
Track = Animator:LoadAnimation(mod.holdone)
else
Track = Animator:LoadAnimation(mod.holdtwo)
end
Track:Play()
holding=true
repeat wait() until not holding
Track:Stop()
end
function release()
local ReleaseTrack
if Attack == 1 then
ReleaseTrack = Animator:LoadAnimation(mod.slashone)
else
ReleaseTrack = Animator:LoadAnimation(mod.slashtwo)
end
ReleaseTrack:Play()
if Attack == 1 then Attack = 2 else Attack = 1 end
LastClick = tick()
end
UIS.InputBegan:Connect(function(input, typing)
if input.UserInputType == Enum.UserInputType.MouseButton1 and equipped and not holding and not cantClick then
cantClick=true
hold()
if equipped then
release()
wait(.8)
cantClick=false
end
else
end
end)
UIS.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
holding=false
end
end)
Tool.Equipped:Connect(function()
equipped=true
if unequippedduringhold == false then
else
unequippedduringhold=nil
cantClick=true
wait(1)
cantClick=false
end
end)
Tool.Unequipped:Connect(function()
equipped=false
if holding then
unequippedduringhold=true
end
end)