Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

IS there nothing that fufills ths idea?

local BackPack = {sb.I1, sb.I2, sb.I3,sb.I4,sb.I5,sb.I6,sb.I7,sb.I8,sb.I9,sb.I10,sb.I11,sb.I12,sb.I13,sb.I14,sb.I15, sb.I16,sb.I17,sb.I18,sb.I19,sb.I20,sb.I21,sb.IF}				

if Mouse.Target:FindFirstChild("Mel") then
	for i, v in pairs (BackPack) do
    		if v.empty.Value == 0 and v.Visible == true then --troublingpoint
       					 v.Nam.Value = Mouse.Target.NM.Value 
       					 v.Dec.Value = Mouse.Target.Dec.Value 
						 v.empty.Value = 1
        				Mouse.Target:Destroy()

So if you look at the script above at troubling point You will notice the v's. I experimented those v's with next(), +1, etc. I can't find anything else that will help me make v equal the v values after that in the table. Like if v is equal to sb.I1 how can i make it so that v = sb.I2 in the same for statement? I'm trying to make an inventory system that makes melee weapons take a slot and make 2 slots in front of it to be visible = false. I'm starting to think that hardscripting like the following will be a better option for me.

s = script.Parent

if Mouse.Target:FindFirstChild("Mel") then
if s.bot.I1.empty.Value == 0 and s.bot.I1.Visible == true and s.bot.I2.empty.Value == 0 and s.bot.I2.Visible == true and s.bot.I3.empty.Value == 0 and s.bot.I3.Visible == true then
					
					s.bot.I1.Nam.Value = Mouse.Target.NM.Value 
					s.bot.I1.Dec.Value = Mouse.Target.Dec.Value 
					s.bot.I1.empty.Value = 1
					s.bot.I2.Visible = false 
					s.bot.I3.Visible = false
					Mouse.Target:Destroy()

1 answer

To add to a value, you do this:

num = num + 1

And to look for something with a value/string, do this:

local part = game.Workspace["Part" ..num]

Hopefully this helped, please don't downvote if this wasn't your question, I had to re-read your question 3 times to figure out what you wanted :)

2 comments

0

@thedeadlypanther its fine man i donwn downvote liek that im not that bad of a person XD

0

TY, that's good. I get so annoyed when someone downvotes me for their own problem lol.

This discussion is preserved as it was. New answers, comments, and votes are closed.