So I wanted to make it where a serverscript sends a remotefunction to the local script and change the color of the text but the error I got was usual. I tried looking into it countless times, but I can’t fix the problem. The error said:
12:55:49.118 - Players.Enchanted_Tix.PlayerGui.Core.Core:116: attempt to index local 'chosenmap' (a nil value)
server script: (A part of the script)
local function maptext(chosenmap)
local mapsettings = chosenmap.SettingsFolder
text.Value = ""..mapsettings.MapName.Value.." ("..mapsettings.Difficulty.Value..") by: "..mapsettings.OwnerTitle.Value
wait(1)
for i, v in pairs(game.Players:GetPlayers()) do
game.ReplicatedStorage.Functions.ColorTitle:FireAllClients(chosenmap, v)
end
wait(4)
for i, v in pairs(game.Players:GetPlayers()) do
game.ReplicatedStorage.Functions.WhiteTitle:FireAllClients(v)
end
end
local function maptext(chosenmap)
local mapsettings = chosenmap.SettingsFolder
text.Value = ""..mapsettings.MapName.Value.." ("..mapsettings.Difficulty.Value..") by: "..mapsettings.OwnerTitle.Value
wait(1)
print(chosenmap)
for i, v in pairs(game.Players:GetPlayers()) do
print(chosenmap)
game.ReplicatedStorage.Functions.ColorTitle:FireAllClients(chosenmap, v)
print(chosenmap)
end
print(chosenmap)
wait(4)
for i, v in pairs(game.Players:GetPlayers()) do
game.ReplicatedStorage.Functions.WhiteTitle:FireAllClients(v)
end
end
Can you please try this script and send me an image of the output please?
What is the type of MapKit? If it’s an instance, where is it stored? If it’s in a server-only location, LocalScripts obviously can’t access it, and roblox will, quite stupidly IMO, make the variable nil inside the LocalScript.
FireAllClients fires it to all the clients at once. If you want to fire variables to one client you need to use FireClient with the first variable being the target player.
Then LocalScripts cannot access it, and the variable will be nil. I’m not sure what you’re trying to accomplish here, so I don’t know what the purpose of MapKit is and where it should be stored. Problem found, next part is the solution to it.
If there’s only 1 child inside the folder then reference only that one child directly and do not create a table of children because you do not need to. Also keep the chosenmap data in ReplicatedStorage so that the Server and Client can see it so you won’t keep getting nil.