Output say attempt to call a nil value. Shared is created like this. If anything, these are excerpts of scripts.
if shared.is_banned_in_team(Player, TEAM) then -- Output says about this line
script.Parent.TextScaled = false
script.Parent.TextSize = 25
script.Parent.Text = "Фракция заблокирована за нарушение."
return
end
elseif state == "Transfer" and MyModel:WaitForChild("DetainESF") then
shared.ban_in_team(CurrentPlayer, CurrentPlayer.Team)
CurrentPlayer.Team = game:GetService("Teams")["Test Subject"]
CurrentPlayer:LoadCharacter()
I haven’t changed much, but it still doesn’t work. Below I will attach all the scripts related to shared.
local bans_default = {}
local ban_info = {}
local function shallow_copy(original)
local copy = {}
for key, value in pairs(original) do
copy[key] = value
end
return copy
end
for _, Teamq in pairs(game.Teams:GetChildren()) do
bans_default[Teamq.Name] = false
end
shared.ban_in_team = function(Player: Player, Teamq: Team) : nil
ban_info[Player.UserId][Teamq.Name] = true
end
shared.is_banned_in_team = function(Player: Player, Teamq: Team) : boolean
print(ban_info)
return ban_info[Player.UserId][Teamq.Name]
end
game.Players.PlayerAdded:Connect(function(player: Player)
ban_info[player.UserId] = shallow_copy(bans_default)
end)
if shared.ban_in_team(Player, Teamq) then
script.Parent.TextScaled = false
script.Parent.TextSize = 25
script.Parent.Text = "Фракция заблокирована за нарушение."
return
end
elseif state == "Transfer" and MyModel:WaitForChild("DetainESF") then
shared.ban_in_team(CurrentPlayer, CurrentPlayer.Team)
CurrentPlayer.Team = game:GetService("Teams")["Test Subject"]
CurrentPlayer:LoadCharacter()
end
The error you’re getting mainly occurs when you are trying to call a function that does not exist OR when calling a function with a nil variable. Did you check that both variables Player and TEAM are not nil?