Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

sitting not a value of vehicle seat error?

Asked by 5 years ago

so, i'm trying to make this script that gives you money when you drive, however, it keeps giving the error "sitting is not a value of vehicleseat" and i have no clue how to fix it.

(first timing using this site, not rlly know how it works, so here is a screenshot of the script.)

0
what is sitting? It's not a property unless you made it one vissequ 105 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

https://developer.roblox.com/api-reference/property/Seat/Occupant

Occupant is a property of seats. It will have the Humanoid Object that is seated in it. With this, you can use the PlayersService to convert this Humanoid into a Player Object and change their leaderstats.

local humanoidSeated = Seat.Occupant
local characterSeated = humanoidSeated.Parent --the humanoid's parent is the character
local playerSeated = game.Players:GetPlayerFromCharacter(characterSeated)
--change leaderstats accordingly
0
so, this fixed the ".... not a value of vehicle seat" error, but now i get the error "attempt to index global 'seat' (a nil value)" blokskesman -8 — 5y
Ad

Answer this question