I’ve been messing around with my script, trying numerous different things, but when I tried to use OnServerInvoke within my remote function, it doesn’t print., nor does it pass arguments that I wish for it to pass… Below you’ll find the scripts I’ve been using to invoke my function. Hopefully its a simple fix.
Serverscript
local replicatedStorage = game:GetService("ReplicatedStorage")
local iconFunction = replicatedStorage.IconChangeFunction
local Players = game:GetService("Players")
iconFunction.OnServerInvoke = function(player, Image)
print("Testing", Image)
local Playerlist = player.PlayerGui.Playerlist
local Template = Playerlist.Frame.Handler.Template
local Icon = Template.Icon
if Icon.Image then
end
end
Localscript
localPlayer:GetPropertyChangedSignal("Team"):Connect(function()
local function localIconChange()
for i, value in pairs(TeamArray) do
if localPlayer.TeamColor == TeamArray[1] then
Icon.Active = true
Icon.Image = iconImageArray
elseif localPlayer.TeamColor == TeamArray[2] then
Icon.Active = true
Icon.Image = iconImageArray[2]
elseif localPlayer.TeamColor == TeamArray[3] then
Icon.Active = true
Icon.Image = iconImageArray[3]
elseif localPlayer.TeamColor == TeamArray[4] then
Icon.Active = true
Icon.Image = iconImageArray[4]
elseif localPlayer.TeamColor == TeamArray[5] then
Icon.Active = true
Icon.Image = iconImageArray[5]
end
iconFunction:InvokeServer(Icon.Image)
You are just creating a new function inside the callback function i.e. local function localIconChange() is being defined inside the callback, which does nothing.
Move the contents of the function localIconChange outside and start debugging.
That’s the issue you’re facing.