--FIRST SCRIPT (HANDLES ONSERVEREVENT)
local RepliStorage = game:GetService("ReplicatedStorage")
local emoteEvent = RepliStorage.sendEmote
local emotesFolder = RepliStorage:WaitForChild("Animations")
emoteEvent.OnServerEvent:Connect(function(player, emoteN)
print("This print works.")
if emoteN and emotesFolder:FindFirstChild(emoteN) then
print("This print doesn't work.")
local pEmotes = player.Emotes
if not pEmotes:FindFirstChild(emoteN) then
emotesFolder[emoteN]:Clone().Parent = pEmotes
print("Player has now recieved an emote.")
end
end
end)
--SECOND SCRIPT (HANDLING FIRE EVENT)
while task.wait(0.1) do
countDown -= 1
clockMin = countDown/internalClockMin
countValue.Value = clockMin
countValue.Changed:Connect(function()
countValue.Value = clockMin
end)
emoteText.Text = "next emote in "..string.format("%.2f", clockMin).." minutes..."
if countDown == 0 then
task.wait(0.1)
countDown = 60
local emoteN
repeat
emoteN = emoteF[math.random(1, #emoteF)]
until not folderEmote:FindFirstChild(emoteN)
sendEmote:FireServer(emoteN)
print("Lauched emote event.")
end
end
The second script works as intended, it even fires the event. The first script only fires the first print, and somehow the second print just doesn’t… well, print. It already printed the emoteN and player (First Script).
emoteN keeps checking through the emoteF folder (it being the animations) until it sees that emoteN from emoteF is not in the player’s inventory (folderEmote)
And plus, both scripts (the two blocks of code) are different. The first being a ServerScript, and the second being a Local.
This condition prevents the code from continuing, it means that emoteN in emotesFolder doesn’t exist. Check if emoteN’s name matches with one emote in the emotesFolder in ReplicatedStorage
Try also printing the condition to see if it’s nil and changing FindFirstChild to WaitForChild. If it gives a warning then it doesn’t exist in emotesFolder