saluta Posted May 20, 2021 Share Posted May 20, 2021 How to fix this error addEventHandler("onClientGUIClick", resourceRoot, function() if (source == Grid_VS) then local carName = guiGridListGetItemText(Grid_VS, guiGridListGetSelectedItem(Grid_VS), 1) local carID = getVehicleModelFromNewName(carName) or getVehicleModelFromName(carName) local c1, c2, c3, c4 = unpack(vehicleSpeeds[carID]) guiSetText(cLbl[1], "Stoke. speed: "..c1.." km/h.") guiSetText(cLbl[2], "Max. speed: "..c2.." km/h.") guiSetText(cLbl[3], "Acceleration 0-100 for "..c3.." s.") guiSetText(cLbl[4], "Drive unit: "..c4..".") end end) Spoiler https://imgur.com/a/MWIAKr5 photo Link to comment
Moderators IIYAMA Posted May 20, 2021 Moderators Share Posted May 20, 2021 1 hour ago, saluta said: How to fix this error You should first check if the table exist. If not, fill in the blanks. local blankValue = "-" local c1, c2, c3, c4 = blankValue, blankValue, blankValue, blankValue local speedData = vehicleSpeeds[carID] if speedData then c1, c2, c3, c4 = unpack(speedData) end guiSetText(cLbl[1], "Stoke. speed: "..c1.." km/h.") guiSetText(cLbl[2], "Max. speed: "..c2.." km/h.") guiSetText(cLbl[3], "Acceleration 0-100 for "..c3.." s.") guiSetText(cLbl[4], "Drive unit: "..c4..".") Link to comment
saluta Posted May 21, 2021 Author Share Posted May 21, 2021 12 hours ago, IIYAMA said: You should first check if the table exist. If not, fill in the blanks. local blankValue = "-" local c1, c2, c3, c4 = blankValue, blankValue, blankValue, blankValue local speedData = vehicleSpeeds[carID] if speedData then c1, c2, c3, c4 = unpack(speedData) end guiSetText(cLbl[1], "Stoke. speed: "..c1.." km/h.") guiSetText(cLbl[2], "Max. speed: "..c2.." km/h.") guiSetText(cLbl[3], "Acceleration 0-100 for "..c3.." s.") guiSetText(cLbl[4], "Drive unit: "..c4..".") Thank you so much, low bow. 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now