Hello there, I can’t figure out why but the buttons don’t work on my emotes system, I tried to add print sections to help me debug it, but it turns out that the button doesn’t get registered.
Client script:
local plr = game.Players.LocalPlayer
local com = game.ReplicatedStorage.Communicator
local currentlyplaying
local currentlyplayingval = false
repeat wait() until plr.CharacterAdded:Wait()
local char = plr.Character or plr.CharacterAdded:Wait()
wait(1)
script.Parent.BestMates.MouseButton1Click:Connect(function()
print("clicked")
if currentlyplaying == "BestMates" and currentlyplayingval == true then
print("fired to stop emotes")
com:FireServer("StopEmotes")
script.Parent.Visible = false
else
com:FireServer("PlayEmote","BestMates",{plr = plr, char = char})
script.Parent.Visible = false
currentlyplaying = "BestMates"
currentlyplayingval = true
end
end)
script.Parent.GetGriddy.Animated.MouseButton1Click:Connect(function()
if currentlyplaying == "Griddy" and currentlyplayingval == true then
com:FireServer("StopEmotes")
script.Parent.Visible = false
else
com:FireServer("PlayEmote","Griddy",{plr = plr, char = char})
script.Parent.Visible = false
currentlyplaying = "Griddy"
currentlyplayingval = true
end
end)
script.Parent.InDaParty.Animated.MouseButton1Click:Connect(function()
if currentlyplaying == "InDaParty" and currentlyplayingval == true then
com:FireServer("StopEmotes")
script.Parent.Visible = false
else
com:FireServer("PlayEmote","InDaParty",{plr = plr, char = char})
script.Parent.Visible = false
currentlyplaying = "InDaParty"
currentlyplayingval = true
end
end)
script.Parent.JubiSlide.Animated.MouseButton1Click:Connect(function()
if currentlyplaying == "JubiSlide" and currentlyplayingval == true then
com:FireServer("StopEmotes")
script.Parent.Visible = false
else
com:FireServer("PlayEmote","JubiSlide",{plr = plr, char = char})
script.Parent.Visible = false
currentlyplaying = "JubiSlide"
currentlyplayingval = true
end
end)
Server script:
local animmodule = require(game.ReplicatedStorage.EmoteModule)
local gmusic = game:GetService("SoundService").SoundGroup
function fadein(plr)
if plr.PlayerGui.Main.Settings.LowVolume.Value == false then
for i, music in gmusic:GetChildren() do
music.Volume = 1.5
wait(0.05)
music.Volume = 1.4
wait(0.05)
music.Volume = 1.3
wait(0.05)
music.Volume = 1.2
wait(0.05)
music.Volume = 1.1
wait(0.05)
music.Volume = 1
wait(0.05)
music.Volume = 0.9
wait(0.05)
music.Volume = 0.8
wait(0.05)
music.Volume = 0.7
wait(0.05)
music.Volume = 0.6
wait(0.05)
music.Volume = 0.5
end
elseif plr.PlayerGui.Main.Settings.LowVolume.Value == true then
for i, music in gmusic:GetChildren() do
music.Volume = 0.8
wait(0.05)
music.Volume = 0.7
wait(0.05)
music.Volume = 0.6
wait(0.05)
music.Volume = 0.5
end
end
end
function fadeout(plr)
if plr.PlayerGui.Main.Settings.LowVolume.Value == false then
for i, music in gmusic:GetChildren() do
music.Volume = 0.5
wait(0.05)
music.Volume = 0.6
wait(0.05)
music.Volume = 0.7
wait(0.05)
music.Volume = 0.8
wait(0.05)
music.Volume = 0.9
wait(0.05)
music.Volume = 1
wait(0.05)
music.Volume = 1.1
wait(0.05)
music.Volume = 1.2
wait(0.05)
music.Volume = 1.3
wait(0.05)
music.Volume = 1.4
wait(0.05)
music.Volume = 1.5
end
elseif plr.PlayerGui.Main.Settings.LowVolume.Value == true then
for i, music in gmusic:GetChildren() do
music.Volume = 0.5
wait(0.05)
music.Volume = 0.6
wait(0.05)
music.Volume = 0.7
wait(0.05)
music.Volume = 0.8
end
end
end
local Emotes = {
["BestMates"] = function(params)
local plr = params.plr
local char = params.char
local track = animmodule.PlayAnim(char,script.BestMates)
local assets = {}
track.Stopped:Connect(function()
fadeout(plr)
for i,v in pairs(assets) do
v:Destroy()
end
end)
fadein(plr)
table.insert(assets,animmodule.PlaySound(char,script.BestMates1))
end,
["Griddy"] = function(params)
local plr = params.plr
local char = params.char
local track = animmodule.PlayAnim(char,script.Griddy)
local assets = {}
track.Stopped:Connect(function()
fadeout(plr)
for i,v in pairs(assets) do
v:Destroy()
end
end)
fadein(plr)
table.insert(assets,animmodule.PlaySound(char,script.Griddy1))
table.insert(assets,animmodule.PlaySound(char,script.Griddy2))
end,
["InDaParty"] = function(params)
local plr = params.plr
local char = params.char
local track = animmodule.PlayAnim(char,script.InDaParty)
local assets = {}
track.Stopped:Connect(function()
fadeout(plr)
for i,v in pairs(assets) do
v:Destroy()
end
end)
fadein(plr)
table.insert(assets,animmodule.PlaySound(char,script.InDaParty1))
table.insert(assets,animmodule.PlaySound(char,script.InDaParty2))
end,
["JubiSlide"] = function(params)
local char = params.char
local track = animmodule.PlayAnim(char,script.JubiSlide)
local assets = {}
track.Stopped:Connect(function()
for i,v in pairs(assets) do
v:Destroy()
end
end)
end,
}
game.ReplicatedStorage.Communicator.OnServerEvent:Connect(function(plr,mode,replicateName,params)
print("communicator fire detected, plr: "..plr.Name..", mode: "..mode..", emote: "..replicateName.." params: "..params)
if mode == "PlayEmote" then
if Emotes[replicateName] then
animmodule.StopAllAnims(plr.Character)
print("stopped emotes")
Emotes[replicateName](params)
print("started playing emote")
end
elseif mode == "StopEmotes" then
animmodule.StopAllAnims(plr.Character)
print("stopped emotes")
end
end)
I’d be very happy if anyone could help me out