What I want
Basically each time I equip a tool an animation plays and whenver I unequip it it stops, kind of like an idle
What’s the issue?
The animation never stops
local script
local plr = game.Players.LocalPlayer
local replicatedStorage = game:GetService(“ReplicatedStorage”)
local transparent = replicatedStorage.Books.Transparent
script.Parent.Equipped:Connect(function()
transparent:FireServer(“visible”)
end)
script.Parent.Unequipped:Connect(function()
transparent:FireServer(“transparent”)
end)
server script
transparent.OnServerEvent:Connect(function(player,stringvalue)
local FXFolderMagic = game.ServerScriptService:WaitForChild(“FXFolderMagic”)
local Anims = FXFolderMagic.Anims
local char = player.Character
local hum = char:WaitForChild(“Humanoid”)
local humrp = char:WaitForChild(“HumanoidRootPart”)
local Animation = hum:LoadAnimation(Anims.BookHold)
if stringvalue == "visible" then
Animation:Play()
for i,v in pairs(book2:GetDescendants()) do
if (v:IsA("BasePart")) then
v.Transparency = 0
end
end
for i,v in pairs(book:GetDescendants()) do
if (v:IsA("BasePart")) then
v.Transparency = 1
end
end
end
if stringvalue == "transparent" then
Animation:Stop()
for i,v in pairs(book2:GetDescendants()) do
if (v:IsA("BasePart")) then
v.Transparency = 1
end
end
for i,v in pairs(book:GetDescendants()) do
if (v:IsA("BasePart")) then
v.Transparency = 0
end
end
end
end)