Hello,
I have a question. This script below was working before (I guess, I'm not really sure anymore), but now it doesn't. I don't know why. It's supposed to work like this: When the player has sat, a GUI will pop up and once the player left the seat, it'll remove. Could anyone tell me why this script isn't working?
local vehicleseat = script.Parent
local GUI = script.DeleteGUI
script.Parent.Changed:connect(function(property)
if property == "Occupant" then
local humanoid = vehicleseat.Occupant
if humanoid then
GUI:clone().Parent = game.Players:GetPlayerfromcharacter(humanoid.Parent):WaitForChild("PlayerGui")
else
game.Players:GetPlayerFromCharacter(humanoid.Parent).PlayerGui:Destroy()
end
end
end)
Thanks in advance.

3 comments
i forgot to add :Destroy() btw
Oh wow!! I was probably too fast! But now I have this problem: http://prntscr.com/kl5yyn (attempt to index local 'humanoid' (a nil value)). When is stands up, the GUI doesn't delete as the script couldn't find the player again. How do I fix that?
Nvm! Fixed everything! Thank you tantec :)