and then on a Bindable Event that gives the bolder that hit it I wish to find the bolders name and then set it’s position back to where it needs to go.
ServerStorage.Events.LavaHit.Event:Connect(function(Bolder)
--- Find the bolder with the same Name inside the table then set it's position to that value ---
end)
local lookingFor = "Bolder"
for i, v in pairs(BolderPositions) do
-- i = key (e.g. Bolder, Bolder2), v = value (the positions)
if i == lookingFor then
-- key found
end
end
With a regular table, you could use myTable[Index], with a dictionary you would do myTable[Key]
local BolderPositions = {
-- Key = Value --
["Bolder"] = Bolders.Bolder.Position, -- get with BolderPositions["Bolder"]
Bolder2 = Bolders.Bolder2.Position, -- get with BolderPositions["Bolder2"]
Bolder3 = Bolders.Bolder3.Position, -- get with BolderPositions["Bolder3"]
Bolder4 = Bolders.Bolder4.Position, -- etc.
Bolder5 = Bolders.Bolder5.Position,
Bolder6 = Bolders.Bolder6.Position
}
Just read the edit, so Bolder.Name would be the key, BolderPositions[Bolder.Name] is the value.
A key is a string, if the keys are the same as the name of the instance they are associated with, then Bolder.Namewould be the name of the key, because that’s how you named them.
so by the way, the key is the string associated with the value, the value being the position, and the key being the bolder name
ServerStorage.Events.LavaHit.Event:Connect(function(Bolder)
local position= BolderPositions[Bolder.Name] -- position is the value, Bolder.Name is the key
Bolder.Position = position
Bolder.Anchored = true
Bolder.Transparency = 1
Bolder.CanCollide = false
Bolder.CanTouch = false
end)