You can write your topic however you want, but you need to answer these questions:
- **Script says Animation track stops the animation but it stays as playing.(more in the vid)
2.Watch 2024-03-23 13-13-53 | Streamable as in the video at the last part script says that the animation is stopped but its not
- **I tried printing the animations that are getting played but it doesnt show the animation thats getting played
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DropItem = ReplicatedStorage.RE.DropItem
local DropNonStackableItem = ReplicatedStorage.RE.DropNonStackableItem
local ViewModeltem = ReplicatedStorage.RE.ViewModeltem
local DeleteItem = ReplicatedStorage.RE.DeleteItem
local player = game.Players.LocalPlayer
local MainGui = script.Parent
local ActivatedGui = MainGui.Parent.Parent:WaitForChild("ViewModelSlotNumber")
local ActivatedGuiItem = MainGui.Parent.Parent:WaitForChild("ViewModelCurrentItem")
local ViewModel = game.Workspace.Camera.ViewModel
local animations = {
["Idle"] = ViewModel.AnimationController.Animator:LoadAnimation(ReplicatedStorage.ViewModelAnims.Idle),
["HoldNormalItem"] = ViewModel.AnimationController.Animator:LoadAnimation(ReplicatedStorage.ViewModelAnims.HoldNormalItem),
["Axe"] = ViewModel.AnimationController.Animator:LoadAnimation(ReplicatedStorage.ViewModelAnims.Axe),
["Knife"] = ViewModel.AnimationController.Animator:LoadAnimation(ReplicatedStorage.ViewModelAnims.Knife),
["Pickaxe"] = ViewModel.AnimationController.Animator:LoadAnimation(ReplicatedStorage.ViewModelAnims.Pickaxe)
}
animations.Idle:Play()
-----------------------------SLOT-GET-VPFRAME------------------------------
local function getViewPortFrame(frame)
for _, v in ipairs(frame:GetChildren()) do
if v:IsA("ViewportFrame") then
return v
end
end
return nil
end
local slotHandDelay = false --DELAYS
---------------------ATTACH-ITEM-------------------------------
function AttachItemToVM(ItemToHold)
game.Workspace.Camera.ViewModel.ItemPos.Item.Part1 = ItemToHold
ItemToHold.Position = game.Workspace.Camera.ViewModel.ItemPos.Position
ItemToHold.Parent = game.Workspace.Camera.ViewModel.ItemPos
end
-----------------------------SLOT-1-------------------------------
MainGui.Slot1.MouseButton2Down:Connect(function()
if ActivatedGui.Value ~= MainGui.Slot1.Name then
if ActivatedGui.Value == MainGui.Slot1.Name then
animations.Idle:Play()
end
local MainSlot = MainGui.Slot1
local getItem = getViewPortFrame(MainSlot)
if MainGui.Slot1.HowMany.Value > 1 then
local DropItem = DropItem:InvokeServer(getItem)
else
local DropNonStackableItem = DropNonStackableItem:InvokeServer(getItem)
end
end
end)
MainGui.Slot1.MouseButton1Down:Connect(function()
local MainSlot = MainGui.Slot1
local getItem = getViewPortFrame(MainSlot)
local slot = "Slot1"
if getItem then
local ItemToHold = game.ReplicatedStorage.VMItemModels:FindFirstChild(getItem.Name):Clone()
if ActivatedGui.Value == "" then
if MainGui.SlotsItemName.Slot1.Value ~= "" then
if MainGui.SlotsItemName.Slot1.Value == getItem.Name then
if getItem:FindFirstChild(getItem.Name).WhatItem.Value == "Axe" then
AttachItemToVM(ItemToHold)
animations.Idle:Stop()
animations.Axe:Play()
local guiItem = getItem.Name
local ItemClass = "Axe"
ViewModeltem:FireServer(slot, guiItem, ItemClass)
elseif getItem:FindFirstChild(getItem.Name).WhatItem.Value == "Normal Item" then
AttachItemToVM(ItemToHold)
animations.Idle:Stop()
animations.HoldNormalItem:Play()
local guiItem = getItem.Name
local ItemClass = "Normal Item"
ViewModeltem:FireServer(slot, guiItem, ItemClass)
elseif getItem:FindFirstChild(getItem.Name).WhatItem.Value == "Pickaxe" then
AttachItemToVM(ItemToHold)
animations.Idle:Stop()
animations.Pickaxe:Play()
local guiItem = getItem.Name
local ItemClass = "Pickaxe"
ViewModeltem:FireServer(slot, guiItem, ItemClass)
elseif getItem:FindFirstChild(getItem.Name).WhatItem.Value == "Knife" then
AttachItemToVM(ItemToHold)
animations.Idle:Stop()
animations.Knife:Play()
local guiItem = getItem.Name
local ItemClass = "Knife"
ViewModeltem:FireServer(slot, guiItem, ItemClass)
end
end
end
else
print("no item")
end
end
end)
-----------------------------SLOT-2-------------------------------
MainGui.Slot2.MouseButton2Down:Connect(function()
if ActivatedGui.Value ~= MainGui.Slot2.Name then
if ActivatedGui.Value == MainGui.Slot2.Name then
animations.Idle:Play()
end
local MainSlot = MainGui.Slot2
local getItem = getViewPortFrame(MainSlot)
local getItemName = MainGui:GetChildren()
if MainGui.Slot2.HowMany.Value > 1 then
local DropItem = DropItem:InvokeServer(getItem)
else
local DropNonStackableItem = DropNonStackableItem:InvokeServer(getItem)
end
end
end)
MainGui.Slot2.MouseButton1Down:Connect(function()
-- wait(0.2)
local MainSlot = MainGui.Slot2
local getItem = getViewPortFrame(MainSlot)
local slot = "Slot2"
if getItem then
local ItemToHold = game.ReplicatedStorage.VMItemModels:FindFirstChild(getItem.Name):Clone()
if ActivatedGui.Value == "" then
if MainGui.SlotsItemName.Slot2.Value ~= "" then
if MainGui.SlotsItemName.Slot2.Value == getItem.Name then
if getItem:FindFirstChild(getItem.Name).WhatItem.Value == "Axe" then
AttachItemToVM(ItemToHold)
animations.Idle:Stop()
animations.Axe:Play()
local guiItem = getItem.Name
local ItemClass = "Axe"
ViewModeltem:FireServer(slot, guiItem, ItemClass)
elseif getItem:FindFirstChild(getItem.Name).WhatItem.Value == "Normal Item" then
AttachItemToVM(ItemToHold)
animations.Idle:Stop()
animations.HoldNormalItem:Play()
local guiItem = getItem.Name
local ItemClass = "Normal Item"
ViewModeltem:FireServer(slot, guiItem, ItemClass)
elseif getItem:FindFirstChild(getItem.Name).WhatItem.Value == "Pickaxe" then
AttachItemToVM(ItemToHold)
animations.Idle:Stop()
animations.Pickaxe:Play()
local guiItem = getItem.Name
local ItemClass = "Pickaxe"
ViewModeltem:FireServer(slot, guiItem, ItemClass)
elseif getItem:FindFirstChild(getItem.Name).WhatItem.Value == "Knife" then
AttachItemToVM(ItemToHold)
animations.Idle:Stop()
animations.Knife:Play()
local guiItem = getItem.Name
local ItemClass = "Knife"
ViewModeltem:FireServer(slot, guiItem, ItemClass)
end
end
end
end
end
end)
{
--MORE SLOTS HERE BUT I DELETED( they are same as the others)
}
-----------------------------SLOT-HAND-------------------------------
MainGui.SlotHand.MouseButton1Down:Connect(function()
--print(slotHandDelay)
if slotHandDelay ~= true then
slotHandDelay = true
if ActivatedGuiItem.Value ~= "" then
game.Workspace.Camera.ViewModel.ItemPos:FindFirstChild(ActivatedGuiItem.Value):Destroy()
local slot = ""
local guiItem = ""
local ItemClass = ""
ViewModeltem:FireServer(slot, guiItem, ItemClass)
animations.Idle:Stop()
animations.Idle:Play()
animations.HoldNormalItem:Stop()
animations.Axe:Stop()
animations.Knife:Stop()
animations.Pickaxe:Stop()
end
wait(1)
slotHandDelay = false
end
end)
ViewModeltem.OnClientEvent:Connect(function()
animations.Idle:Stop()
animations.Idle:Play()
animations.HoldNormalItem:Stop()
animations.Axe:Stop()
animations.Knife:Stop()
animations.Pickaxe:Stop()
end)
player.PlayerGui.ViewModelCurrentItem.Changed:Connect(function()
if player.PlayerGui.ViewModelCurrentItem.Value == "" or player.PlayerGui.ViewModelCurrentItem.Value == nil then
animations.Idle:Stop()
animations.Idle:Play()
animations.HoldNormalItem:Stop()
animations.Axe:Stop()
animations.Knife:Stop()
animations.Pickaxe:Stop()
else
animations.Idle:Stop()
end
end)
DeleteItem.OnClientEvent:Connect(function()
local slot = ""
local guiItem = ""
local ItemClass = ""
if game.Workspace.Camera.ViewModel.ItemPos:FindFirstChild(ActivatedGuiItem.Value) then game.Workspace.Camera.ViewModel.ItemPos:FindFirstChild(ActivatedGuiItem.Value):Destroy()
else
print("Game Broken or Deleted from another script")
end
wait(tick)
ViewModeltem:FireServer(slot, guiItem, ItemClass)
animations.Idle:Stop()
animations.Idle:Play()
animations.HoldNormalItem:Stop()
animations.Axe:Stop()
animations.Knife:Stop()
animations.Pickaxe:Stop()
end)
script.Parent.TextButton.MouseButton1Click:Connect(function()
print(ViewModel.AnimationController:GetPlayingAnimationTracks())
end)
I also checked every single thing possible but they are all working like they should.