local LVRMotor = script.Parent.Parent.Parent.Indoor
local IndoorID = script.Parent.Parent.IndoorCtrlID
local INDMotor = script.Parent.Parent.Parent.Indoor.MotorIND.HingeConstraint
local OUTMotor = script.Parent.Parent.Parent.Outdoor.MotorOUT.HingeConstraint
local Beep = script.Parent.Parent.Parent.Indoor.Fan.chime
local Wind = script.Parent.Parent.Parent.Indoor.Fan.Sound
local Cmprs = script.Parent.Parent.Parent.Outdoor.Fan.OUTDOOR
local CmprsS = script.Parent.Parent.Parent.Outdoor.Fan.Startup
local OpLamp = script.Parent.Parent.Parent.Indoor.Operation
local ClickD = script.Parent.ClickDetector
hereās my code, so how do I make it include the āIndoorIDā number in ālocal LVRMotor = script.Parent.Parent.Parent.Indoorā ?
Iām doing this for a VRF or VRV air conditioner system and i donāt want to change all the settings manually one by one which can be time consuming
local IndoorID = script.Parent.Parent.IndoorCtrlID
-- if script.Parent.Parent.Parent.Indoor is a string...
local LVRMotor = script.Parent.Parent.Parent.Indoor .. tostring(IndoorID)
-- if script.Parent.Parent.Parent.Indoor is _not_ a string
local LVRMotor = tostring(script.Parent.Parent.Parent.Indoor) .. tostring(IndoorID)
local str = "hello_123" --put your string here
local strSplit = string.split(str, "_")
local numbers = ""
local characters = ""
for _, char in pairs(strSplit) do
if tonumber(char) then
numbers = numbers..char
else
characters = numbers..char
end
end
local numberID = 3
workspace.Model["DoorPart"..tostring(numberID)]
print(workspace.Model["DoorPart"..tostring(numberID)])
So for your task since you use a NumberValue it would maybe look like this:
local LVRMotor = script.Parent.Parent.Parent.Indoor
local IndoorID = script.Parent.Parent.IndoorCtrlID
LVRMotor.Parent["LVRMotor"..tostring(IndoorID.Value)]
NOTE: I know this reply is 8 months late, but the post is not marked as solved yet and I happened to run by.