I am unsure as to what is causing this, but for some reason what I wrote is getting interpreted as trying to access the replicatedstorage, while the script in of itself isn’t trying to access replicatedstorage at all. Below you may find the script responsible.
local replicatedStorage = game:GetService("ReplicatedStorage")
local iconEvent = replicatedStorage.IconChangeEvent
local Players = game:GetService("Players")
local function iconSwitch(player, teamArray, iconArray)
if teamArray[1] then
local Playerlist = player.PlayerGui.WaitForChild("Playerlist")
local Handler = Playerlist.Frame.Handler
local Icon = Handler.Template.Icon
if Icon then
Icon.Image = iconArray[1]
end
ah, whilst looking at my script, I realized I forgot to remove the old way in which I’ve assigned icons to the playerlist. Now that I’ve removed that old script, it seems to keep referencing ReplicatedStorage, without adding any icons…
local replicatedStorage = game:GetService("ReplicatedStorage")
local iconEvent = replicatedStorage.IconChangeEvent
local Players = game:GetService("Players")
local function iconSwitch(player, teamArray, iconArray)
if iconArray[1] then
local Playerlist = player.PlayerGui:WaitForChild("Playerlist")
local Handler = Playerlist.Frame.Handler
local Icon = Handler.Template.Icon
Icon.Image = nil
if Icon then
Icon.Image = iconArray[1]
end
elseif teamArray[2] then
local Playerlist = player.PlayerGui:WaitForChild("Playerlist")
local Handler = Playerlist.Frame.Handler
local Icon = Handler.Template.Icon
Icon.Image = nil
if Icon then
Icon.Image = iconArray[2]
end
elseif teamArray[3] then
local Playerlist = player.PlayerGui:WaitForChild("Playerlist")
local Handler = Playerlist.Frame.Handler
local Icon = Handler.Template.Icon
Icon.Image = nil
if Icon then
Icon.Image = iconArray[3]
end
elseif teamArray[4] then
local Playerlist = player.PlayerGui:WaitForChild("Playerlist")
local Handler = Playerlist.Frame.Handler
local Icon = Handler.Template.Icon
Icon.Image = nil
if Icon then
Icon.Image = iconArray[4]
end
elseif teamArray[5] then
local Playerlist = player.PlayerGui:WaitForChild("Playerlist")
local Handler = Playerlist.Frame.Handler
local Icon = Handler.Template.Icon
Icon.Image = nil
if Icon then
Icon.Image = iconArray[5]
end
end
end
iconEvent:FireAllClients(iconSwitch)
Okay so real quick, you can’t send a function through the FireAllClients method, that just won’t work. FireAllClients needs parameters. The function you have should be on the client side (eg localscript) and should be receiving the event.
alright, so what I’ve gathered is that I should copy and paste the function onto my localscript, and at the bottom of the function, post your iconEvent.OnClientEvent:Connect(iconSwitch)?