How do i keep these variables local?

lmao keep removing my posts.

I will explain for the last time.

If you want to talk about an array you say “array”
If you want to talk about a dictionary you say “dictionary”
If you want to talk about an array or a dictionary you say “table”

This is accepted knowledge since arrays and dictionaries behave differently. It’s like saying “train” when you are talking about cars.

I said the difference is negligible, that does not change the fact that you said “array” when talking about “tables” which is why I thought you were talking about “arrays”

1 Like

That unfortunately does not work?
I tried doing what @batteryday said and used a dictionary, for a better explanation i did this:

remote.OnServerEvent:Connect(function(plr)
        TestTable = {


        created = false,
        Animtrack = nil

}

wallrun(TestTable)
end)

and it did not work as in the wallrun function:

wallrun(TestTable)
     local created = TestTable["created"]

      created = true
end

its either it did not save the variables i changed because on another function (removing wallrunning) it has to check created and i set the created to true but it is false in the ‘removeWall’ function.
Any mistakes im doing?

this is being passed by value not by reference so when you do created = true, you are setting “created” to true, not TestTable.created to true.

1 Like

yeah but don’t, array takes longer to index.

While yes it’s probably negligible to worry about indexing

I said the difference is negligible

1 Like
local players = game:GetService("Players")

players.PlayerAdded:Connect(function(player)
	local wallrunval = Instance.new("BoolValue")
	wallrunval.Parent = player
	wallrunval.Value = false
	--toggle this value when the player is wallrunning/not wallrunning
end)
1 Like

Hmm, i applied all of that to my script and didnt work, here is my script since i think its another problem…


local function remove(HRP,tablexd)
	local char = HRP.Parent
	print(tablexd.created)
	if tablexd.created == true and tablexd.bodyVelocity1 ~= nil then
		tablexd.bodyVelocity1:Destroy()
		tablexd.created = false
		tablexd.bodyVelocity1 = nil
		tablexd.anim1:Stop()
		if tablexd.left2 == true then
			bounce(false, HRP,tablexd)
end
end
end
end
end

Thanks

Edit: seems that in the first wallrun it works perfectly but in the second one (if you wallrun to another wall) it will not even create? It makes me jump though, maybe its deleting it?

Edit2: had to just remove the part where it consistently removes it (i dont even remember why i added it)