hello
I’m trying to make a gamepass/premium car and only allow them to drive the car, and if a player that’s not a premium and or has not brought the gamepass the Seat would kick the player out of the seat
I’ve already coded in if the player is in a seat then it’ll activate the if statements, but my problem is, it’s giving me errors about " attempt to index nil with ‘MembershipType’ " it used to give me errors about the player before now it doesn’t because I was editing it trying to fix it then stopped, and now I’m asking for help. I was trying to get the player who’s sitting on the seat and trying to check if they’re premium or not but I’ve failed.
I’ve asked for help on multiple discord servers they tried to help me but it was still giving me error’s and I’ve looked it up in google and I couldn’t really find much about the premium. I’m trying to figure out the premium part first before I start working on the gamepass.
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if Seat.Occupant ~= nil then
countertext.TextLabelS.Visible = false ---ingore this
countertext.TextLabelIU.Visible = true
countertext.TextLabel.Visible = false
else
Spawner.Value = 1 ---ingore this
end
player = game.Players:GetPlayerFromCharacter(script.Parent)
if player.MembershipType == Enum.MembershipType.Premium then
print(player.Name..' has premium!')
else
Seat.Disabled = true
wait(0.1)
Seat.Disabled = false
end
end)
end
Seat.Changed:Connect(onChanged)