Hello,
I’ve created a tool and it requires a unique hold for the animation to work properly. I’m just trying to get the can to attach to the other arm, since by default its attached to the right hand. Here’s what ends up happening (ignore the dummy):
It spawns far from my hand and just drops to the ground. Here’s my code (the holding animation is irrelevant and is placed elsewhere)
local drink = script.Parent
local debounce = false
drink.Equipped:Connect(function()
print("equipped")
local drink = script.Parent
local char = script.Parent.Parent
local humanoid = char:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local player = script:FindFirstAncestorWhichIsA("Player") or game:GetService"Players":GetPlayerFromCharacter(char)
for i, object in pairs(char:GetChildren()) do
if object:IsA("WeldConstraint") then
object:Destroy()
end
end
char.DescendantAdded:Connect(function(object)
if object:IsA("Weld") and object.Name == "RightGrip" then
task.wait()
object:Destroy()
end
end)
--drink.Handle.Position = char.LeftHand.LeftGripAttachment.OriginalPosition.Value
drink.DrinkModel.Handle.Position = char.LeftHand.Position
--drink.DrinkModel.PartThing.Position = char.LeftHand.LeftGripAttachment.OriginalPosition.Value
--drink.DrinkModel.Part.Position = char.LeftHand.LeftGripAttachment.OriginalPosition.Value
local weld = Instance.new("WeldConstraint")
weld.Parent = drink
weld.Part0 = char.LeftHand
weld.Part1 = drink.DrinkModel.Handle
drink.Parent = char
drink.Activated:Connect(function()
if debounce == false then
debounce = true
local drinkanim = Instance.new("Animation")
drinkanim.Parent = player
drinkanim.AnimationId = "rbxassetid://12607085910"
local drinkanimtrack = animator:LoadAnimation(drinkanim)
drinkanimtrack:Play()
drinkanim:Destroy()
humanoid.WalkSpeed = 32
task.wait(5)
humanoid.WalkSpeed = 16
task.wait(5)
debounce = false
end
end)
end)
Note that the print statement doesn’t run, yet I can still “equip” it by pressing 1 (the tool GUI)