You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I’m wanting to use a bool value inside of vehicle’s DriveSeat that when someone who IS NOT the owner of the vehicle enters the vehicle, the bool value is automatically swapped to “true”. It is to set a vehicle’s stolen status to true. From there, I’ll be also scripting it to place a warrant out for the arrest of the player who stole that vehicle, but that’s something for later
What is the issue? Include screenshots / videos if possible!
I’ve tried searching around and found some helpful articles, but for my exact situation I haven’t been able to locate anyone with similar issues. Essentially, the value doesn’t change when a non-owner gets into the vehicle. The value stays false.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Here is a portion of the script I’m using in my PlayerData server script that sets the owner of the vehicle etc. Note that all attributes work fine, none of that is the issue, the issue is simply the bool value not changing.
local carModel = car:clone() carModel.PrimaryPart = carModel:FindFirstChildOfClass("VehicleSeat") carModel:SetPrimaryPartCFrame(carSpawnTiles[carFolder.Name]:GetChildren()[carSpawnIndex + 1].CFrame) carModel.Parent = workspace.SpawnedCars carModel:MakeJoints() carModel.Body.LicensePlate.Rear.SGUI.Identifier.Text = plr.ID.Value carModel:SetAttribute("id", plr.ID.Value) carModel:SetAttribute("type", carFolder.Name) carModel:SetAttribute("owner", plr.Name) local stolen = Instance.new("BoolValue") stolen.Name = "Stolen" stolen.Value = false stolen.Parent = carModel.DriveSeat
Now here is a server script placed inside of the vehicle’s DriveSeat
local stolenValue = script.Parent.Stolen.Value local seat = script.Parent.Parent local carOwner = script.Parent.Parent:GetAttribute("owner") seat:GetPropertyChangedSignal("Occupant"):Connect(function() if tostring(seat.Occupant) == "Humanoid" then local CurrentCharacterOccupyingSeat = seat.Occupant.Parent if CurrentCharacterOccupyingSeat.Name == carOwner then stolenValue = false else stolenValue = true end end end)
If anyone has any idea on a correct path I could go to get this working, you’d have my utmost gratitude!
Thank you in advanced!