So I have made a system where if you are a certain rank in the group you are given a certain ticket. The problem is, it keeps giving me the wrong ticket. I know this is very vague but I would like someone to try to find a flaw in my code that makes this happen.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local debounce = false
local Values = script.Parent.Values
local BusinessClassName = Values.BusinessClassName.Value
local BusinessClassTicket = Values.BusinessClassTicket
local BusinessRank = Values.BusinessRank.Value
local Class3 = Values.Class3.Value
local EconomyClassName = Values.EconomyClassName.Value
local EconomyClassTicket = Values.EconomyClassTicket
local EconomyRank = Values.EconomyRank.Value
local FirstClassName = Values.FirstClassName.Value
local FirstClassTicket = Values.FirstClassTicket
local FirstClassRank = Values.FirstClassRank.Value
local InvestorClassName = Values.InvestorClassName.Value
local InvestorClassTicket = Values.InvestorClassTicket
local InvestorRank = Values.InvestorRank.Value
local groupID = Values.groupID.Value
local Gui = script.Parent:WaitForChild("LoadingGUI")
local GuiClone = Gui:Clone()
GuiClone.Parent = game.ReplicatedStorage
local Brick = script.Parent.SCIParts.Touch
Brick.Touched:Connect(function(hit)
if debounce then return end
if hit.Parent:FindFirstChild("Humanoid") then
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player then
local Gui = game.ReplicatedStorage:WaitForChild("LoadingGUI")
local GuiClone = Gui:Clone()
GuiClone.Parent = Player:WaitForChild("PlayerGui")
debounce = true
wait(5)
if Player:GetRankInGroup(groupID) == EconomyRank then
local ECT = ReplicatedStorage:WaitForChild(EconomyClassTicket.Value):Clone()
ECT.Parent = Player:WaitForChild("Backpack")
else
if Player:GetRankInGroup(groupID) == BusinessRank then
local BCT = ReplicatedStorage:WaitForChild(BusinessClassTicket.Value):Clone()
BCT.Parent = Player:WaitForChild("Backpack")
else
if Player:GetRankInGroup(groupID) == FirstClassRank then
local FCT = ReplicatedStorage:WaitForChild(FirstClassTicket.Value):Clone()
FCT.Parent = Player:WaitForChild("Backpack")
else
if Class3 == false and Player:GetRankInGroup(groupID) == InvestorRank then
local ICT = ReplicatedStorage:WaitForChild(InvestorClassTicket.Value):Clone()
ICT.Parent = Player:WaitForChild("Backpack")
end
end
end
end
end
end
end)
Thanks.