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

What does "bad argument #2 to '?' (string expected, got Object)" mean?

Asked by 8 years ago
Edited 8 years ago

Here is the script; on line 8 where it says game.Players[driver.Value]...

The output always says; "Script:8: bad argument #2 to '?' (string expected, got Object)"

local camlight = script.Parent.Parent:WaitForChild("CamLight")

script.Parent.Touched:connect(function(part)
    if part.Name == "VehicleSeat" then
        local driver = part.Values:WaitForChild("Driver")
        game.Players[driver.Value].PlayerGui.ChatMessage.MessageValue.Value = "Caution!"
    end
end)

I've tried the script with just '[driver]' and at the end of line 8 'MessageValue'

2
It looks like 'driver' is an object value, not a string value. Perci1 4988 — 8y
0
Omg that was my fault, I changed the Driver for Player Value, separate thing. Thanks! :) sodaghost1 34 — 8y

Answer this question