Help on point giving system

Sorry for asking so many questions, but does it matter if the vehicle seat in the car is located in server storage?

Not at all, as it’s checked through the humanoid property. Humanoids will still not be able to seat on anything outside workspace.

Ahh, okay thank you for your support.

Always welcome. Feel free to ask me any questions you might have.

1 Like

To be honest you could do this:

Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
     if Seat.Occupant ~= nil then 
          while (true) do
               if Seat.Occupant == nil then break end
               local Player = game.Players:GetPlayerFromCharacter(Seat.Occupant)
                Player.leaderstats.Points += 20
            end
       end
end)

so would I have to put the script in the vehicle seat or in the server script service?

Anywhere is fine, as long as you define the Seat variable, and it’s a server script.

what does the script mean? What does then break end and changed signal and ~= nil mean?

Basically, a quick rundown.

the “break” end means that bascially the loop will end. For example:

while (true) do 
print("Hey")

break
end

this loop will only print “hey” once because right after the loop the broken, meaning that it no longer prints “hey”.

~= means that it’s not equal to something. For example:

local Number = 6

if Number ~= nil --> if Number exists, and isn't nothing then 

then
   print("Number exists!")
end

Lastly, GetPropertyChangedSignal is pretty self explanatory. GetPropertyChangedSignal runs whenever said property is changed. I’ll give an example using StringValue.

local StringValue = Instance.new("StringValue")

StringValue:GetPropertyChangedSignal("Value"):Connect(function()
     print("This will run at the same time as")
end)

StringValue.Changed:Connect(function()
   print("StringValue.Changed")
end)

1 Like