Hello, I’m making a script that changes a tool’s name and a value in the tool to be something in the table. But for some reason, it works for the first value but then gives me an error.
local toolType = script.Parent:FindFirstChild("ToolType")
local tool = script.Parent
local values = {
[0] = {"Tool",5},
[1] = {"Tool v2",100},
[2] = {"Tool v3",500},
[3] = {"Tool v4",2500},
[4] = {"BugTool",25},
[5] = {"EpicTool",5000}
}
local function value()
for value,name in ipairs(values) do
if toolType.Value == value then
tool.Name = name[value]
tool.AddValue.Value = name[2]
end
end
end
toolType:GetPropertyChangedSignal("Value"):Connect(value)
It’s just very weird. Even I don’t know how it works and I coded it!
The error for anyone that was wanting to know:
Players.MediaHQ.Backpack.Tool.CheckValue:16: invalid argument #3 (string expected, got nil)