Cannot Append or Replace Values of a Slider Item
nicktrick92 opened this issue ยท 1 comments
Hello. I'm trying to modify the values list of a slider item when another slider is changed (To change the wheel options when you change the wheel category). I've tried a couple of different methods, but nothing seems to work. Any time I try to modify the Values property, it changes the list to just have "OPTION" and you can't move it anymore. There are no errors or anything of that sort. Here's my current code:
local wheelTypeSlider = vehModMenu:AddSlider({icon = '๐', label = "Modify Wheel Category", values = GenerateSliderValues(116, 7)})
local wheelSlider = vehModMenu:AddSlider({icon = '๐', label = "Modify Wheel", values = GenerateSliderValues(23, GetNumVehicleMods(myVeh, 23))})
-- SLIDER CHANGED EVENT
wheelTypeSlider:On('change', function(item, newValue, oldValue)
SetVehicleWheelType(myVeh, newValue)
SetVehicleMod(myVeh, 23, 0, false)
Wait(10)
wheelSlider.Values = GenerateSliderValues(23, GetNumVehicleMods(myVeh, 23))
end)
wheelSlider:On('change', function(item, newValue, oldValue)
ApplyModification(myVeh, 23, newValue, 450)
end)
GenerateSliderValues
is a function I created to return a table with the slider options for a certain mod, so I know it's working. The sliders both work fine until I change the wheelType slider, which is when the wheelSlider just shows "OPTION" and is no longer useable. I also tried value
(No capital V) and got a similar issue. The rest of the properties (Such as value, label, etc.) work find, it's just the values property that bugs it out. I assume I'm doing something wrong.
Is there any way I can achieve what I want to do? Thanks in advance.
NOTE: I saw (And used) AddValues()
, but it doesn't do what I need exactly. Unless I can clear the values and then re-add them like that (I'd need to know how to clear), it won't work. I need to fully replace the values list.
I will investigate your issue and I hope give a solution or bug fix.