I have this emoting tool script.
I tried the tool.equipped function but the animations wouldn’t work and the keybinds that triggers the tool wouldn’t work. It doesn’t even send a error.
When I remove that function, the animations are played when the emote keybind is triggered, but that keybind trigger will also play the animation on any other tool or even without tools.
local anim = game.ReplicatedStorage.Celebrations:FindFirstChild(script.Name)
local owns = false
local t1 = TweenInfo.new(0.8, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)
local Indicator = game.Players.LocalPlayer.PlayerGui:WaitForChild("Start"):FindFirstChild("EmoteIndicator")
local tin = game:GetService("TweenService"):Create(Indicator, t1, {TextTransparency = 0})
local tout = game:GetService("TweenService"):Create(Indicator, t1, {TextTransparency = 1})
local MP = game:GetService("MarketplaceService")
local pass = 247391753
local tb = {261745997, 128631812, 131504927, 3777935388}
local Player = game.Players.LocalPlayer
if MP:UserOwnsGamePassAsync(Player.UserId, pass) then
owns = true
end
if table.find(tb, Player.UserId) then
owns = true
end
local GetData = Player:WaitForChild("Keybinds"):FindFirstChild("Celebrations"):FindFirstChild(script.Name).Value
local char = Player.Character or Player.CharacterAdded:Wait()
local UIS = game:GetService("UserInputService")
local humanoid = char:WaitForChild("Humanoid")
local animator = humanoid:FindFirstChildOfClass("Animator")
local track = animator:LoadAnimation(anim)
UIS.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if owns == false then return end
if input.KeyCode == Enum.KeyCode[GetData] then
Player.Character.Humanoid.WalkSpeed = 0
track:Play()
tin:Play()
Indicator.Text = script.Name
end
end)
UIS.InputEnded:Connect(function(input, gameProcessed)
if gameProcessed then return end
if owns == false then return end
if input.KeyCode == Enum.KeyCode[GetData] then
Player.Character.Humanoid.WalkSpeed = 20
track:Stop()
tout:Play()
Indicator.Text = script.Name
end
end)