I made a script where if u click on an NPC it checks whether u own a button (in this case an animation button) if u do own it then the NPC won't give u the animation but if u do not own it then the NPC will give you the animation.
Here's the script:
`local say = {"Waddup Dawg", "You deserve this dance bruh", "Cya man!"}
local Decline = {"I taught you everything man", "Cya man!"}
local RS = game.ReplicatedStorage
local rE = RS.RemoteEvent
local Anim = script.AnimValue
local Rank = Anim.RankValue
script.Parent.ClickDetector.MouseClick:Connect(function(player)
local Frame = player.PlayerGui.Inventory.Frame.ScrollingFrame
if not Frame:FindFirstChild(Anim.Value) then
script.Parent.ClickDetector.MaxActivationDistance = 0
player.leaderstats.Collection.Value = player.leaderstats.Collection.Value + 1
player.PlayerGui.NpcChatGui.Frame1.Frame.NpcName.Text = script.Parent.Name
player.PlayerGui.NpcChatGui.Enabled = true
for i, v in pairs(say) do
for i = 1, string.len(v) do wait(0.025)
player.PlayerGui.NpcChatGui.Frame1.Frame2.NpcText.Text = string.sub(v, 1, i)
end
wait(string.len(v) / 10)
end
player.PlayerGui.NpcChatGui.Enabled = false
rE:FireClient(player, Anim.Value, Rank.Value)
script.Parent.ClickDetector.MaxActivationDistance = 32
else
script.Parent.ClickDetector.MaxActivationDistance = 0
player.PlayerGui.NpcChatGui.Frame1.Frame.NpcName.Text = script.Parent.Name
player.PlayerGui.NpcChatGui.Enabled = true
for i, v in pairs(Decline) do
for i = 1, string.len(v) do wait(0.025)
player.PlayerGui.NpcChatGui.Frame1.Frame2.NpcText.Text = string.sub(v, 1, i)
end
wait(string.len(v) / 10)
end
player.PlayerGui.NpcChatGui.Enabled = false
script.Parent.ClickDetector.MaxActivationDistance = 32
end
end)`
