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

Searching for the Player's Car? [SOLVED]

Asked by 9 years ago

I have a car and when you sit down it names a PlayerName value to the name of your player thorugh the seatweld. Now in a local script I have a script attempting to scan a model and if the PlayerName is the player's name then it sets a variable car = to the players car. This is the code I'm using to scan for the PlayerName

w = workspace.Vehicles:getChildren()
    for i = 1, #w do
        if w[i]:FindFirstChild("PlayerName") then
            if w[i].PlayerName.Value == plr.Name then
                car = w[i]
            end
        end
    end

I can guarantee that the PlayerName value changes to the right name. Thank you for reading and helping out!

Answer this question