The title says it all, my warn command won’t display the images used to display how many warnings you have. (e.g W1, W2, W3)
It does kick you if you have the max amount of warnings, (which is 3 in my case) but none of the images show to actually display the amount of warnings the user has.
Script
local GroupID = 4607825
local MinimumRankToUseCommands = 240
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
local SplitMessage = Message:split(" ")
if SplitMessage[1] == "!warn" and Player:GetRankInGroup(GroupID) >= MinimumRankToUseCommands then
local NameOfPlayerToWarn = SplitMessage[2]
local PlayerToWarn = game.Players:FindFirstChild(NameOfPlayerToWarn)
local WarningGUI = PlayerToWarn.Character.Head.GUI -- Apperently, this line is the problem. :/
local CurrentWarnings = WarningGUI.Warnings
CurrentWarnings.Value = CurrentWarnings.Value + 1
WarningGUI.Frame.WarningImgs.W1.Visible = true
print("Player warned!")
CurrentWarnings.Value = CurrentWarnings.Value + 2
WarningGUI.Frame.WarningImgs.W1.Visible = false
WarningGUI.Frame.WarningImgs.W1.Visible = true
print("Player warned!")
CurrentWarnings.Value = CurrentWarnings.Value + 3
WarningGUI.Frame.WarningImgs.W2.Visible = false
WarningGUI.Frame.WarningImgs.W3.Visible = true
print("Player warned!")
if CurrentWarnings.Value >= 3 then
PlayerToWarn:Kick("You've reached the maximum number of warnings and have been kicked from the server.")
end
end
end)
end)