For some reason, the cloning works fine on one player but not the other. It worked perfectly fine yesterday and no script changes have been made. All it says in the log is that the OverheadPassed is not a valid member for only one player. I am really confused about this so any help would be appreciated.
Code:
--[ Variables
local rep = game:GetService("ReplicatedStorage")
local overhead = rep:WaitForChild("OverheadPassed")
local prefix = "!"
local ts = game:GetService("TweenService")
local board = game.Workspace:WaitForChild("Board")
local passFrame = rep:WaitForChild("Passer")
local boardFrame = board.PassedList.MainFrame
local roles = {"Barista", "Housekeeping", "Security", "Receptionist"}
--[ Setup
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local head = char.Head
local clone = overhead:Clone()
local title = clone.Title
local line = clone.Line
clone.Parent = head
clone.Adornee = head
end)
end)
--[ Configuration
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if plr:GetRankInGroup(13240359) >= 9 then
local msg = string.lower(msg)
local splitMsg = msg:split(" ")
local arg1 = splitMsg[1]
local cmd = arg1:split(prefix)[2]
local user = splitMsg[2]
local role = splitMsg[3]
if cmd == "pass" then
for _, i in ipairs(game.Players:GetPlayers()) do
for _, r in ipairs(roles) do
if i.Name:lower():sub(1, #user) == user and r:lower():sub(1, #role) == role then
local nametag = i.Character.Head.OverheadPassed
nametag.Title.Text = "Passed ["..r.."] by "..plr.Name
local fadeTitle = ts:Create(nametag.Title, TweenInfo.new(1, Enum.EasingStyle.Quart, Enum.EasingDirection.Out, 0, false, 0), {TextTransparency = 0})
local fadeLine = ts:Create(nametag.Line, TweenInfo.new(1, Enum.EasingStyle.Quart, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0})
fadeTitle:Play()
fadeLine:Play()
local passClone = passFrame:Clone()
passClone.Name = "Passer-"..i.Name
passClone.Parent = boardFrame
passClone.Username.Text = i.Name.." - "..r
passClone.Rank.MouseButton1Click:Connect(function()
if plr:GetRankInGroup(13240359) >= 13 then
passClone.Rank.Text = "Ranked"
end
end)
passClone.Clear.MouseButton1Click:Connect(function()
if plr:GetRankInGroup(13240359) >= 13 then
passClone:Destroy()
end
end)
end
end
end
elseif cmd == "unpass" then
for _, i in ipairs(game.Players:GetPlayers()) do
if i.Name:lower():sub(1, #user) == user then
local nametag = i.Character.Head.OverheadPassed
local fadeTitle = ts:Create(nametag.Title, TweenInfo.new(1, Enum.EasingStyle.Quart, Enum.EasingDirection.In, 0, false, 0), {TextTransparency = 1})
local fadeLine = ts:Create(nametag.Line, TweenInfo.new(1, Enum.EasingStyle.Quart, Enum.EasingDirection.In, 0, false, 0), {ImageTransparency = 1})
fadeTitle:Play()
fadeLine:Play()
for _, c in ipairs(boardFrame:GetChildren()) do
if c.Name == "Passer-"..i.Name then
c:Destroy()
end
end
end
end
end
end
end)
end)