this is my first time ever scripting and im making a story game on roblox. im making the lobby and everything is fine until the gui to exit the bus didnt pop up, i checked the output and it says "attempt to index nil with clone" heres a part of my script
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
for i,v in pairs(Seats) do
if Seats.Occupant == nil then
hit.Parent.Humanoid.JumpPower = 0
hit.Parent.Humanoid.WalkSpeed = 0
Gui:Clone().Parent = player.PlayerGui <----- (where the problem occurs)
player.Character.HumanoidRootPart.CFrame = Seats[math.random(1,17)].CFrame
wait(10)
player.PlayerGui.ExitGui:Destroy()

2 comments
You didn't tell what the GUI is, so it is nil. nil means nothing
FORMAT YOUR CODE