Hello, I have a problem with this function.
I want that when a button is pressed, the corresponding piece will disappear. (works)
The problem is that this can only be seen by oneself, since doing a test with a friend, he saw my vehicle normally.
I don't know what's wrong, but I'm sure others can see it, as the wiki example works for all players.
(By the way, I don't know if I'm using the right topic, it's my first time posting.)
This is part of my code, clientside only.
function sacarColinF() -- This function disappears the component
local theVehicle = getPedOccupiedVehicle(localPlayer)
if (theVehicle) then
setVehicleComponentVisible(theVehicle, "colin" , false)
end
end
addEventHandler("onClientGUIClick", sacarColin, sacarColinF)
function ponerColinF() -- This function returns the visibility to the previous component
local theVehicle = getPedOccupiedVehicle(localPlayer)
if (theVehicle) then
setVehicleComponentVisible(theVehicle, "colin" , true)
end
end
addEventHandler("onClientGUIClick", ponerColin, ponerColinF)
I don't know if 'localPlayer' has something to do with it, but changing it to 'source' or 'thePlayer' causes the script to not work correctly.