I wrote a LocalScript for a tool that sets people's WalkSpeed within 30 studs to 1, and puts it back to 16 after 8 seconds. I'm making it add affected players into a table, so it can reset their walkspeed back to 16 again regardless of how far away they are. However, I'm not sure how to do this. Here is the script:
hand = script.Parent
plrs = {}
db = true
script.Parent.Parent.Activated:connect(function()
if db == true then
db = false
pos = game.Players.LocalPlayer.Character.Torso.CFrame
sph = Instance.new("Part")
sph.Name = "TurtleBall"
sph.Parent = game.Workspace
sph.Shape = "Ball"
sph.CFrame = pos
sph.BrickColor = BrickColor.new("Shamrock")
sph.CanCollide = false
sph.Transparency = 0.4
sph.Anchored = true
sph.TopSurface = "Smooth"
sph.BottomSurface = "Smooth"
sph.Size = Vector3.new(3,3,3)
for i = 1,9 do
sph.Size = sph.Size + Vector3.new(3,3,3)
sph.CFrame = pos
wait(0.1)
end
local g = game.Players:GetChildren()
for i = 1,#g do
if (g[i].Character.Torso.Position-script.Parent.Position).magnitude < 30 and g[i].Name ~= game.Players.LocalPlayer.Name then
table.insert(plrs,g[i].Name)
g[i].Character.Humanoid.WalkSpeed = 1
end
print(plrs)
wait(8)
game.Players[table.concat(plrs)].Character.Humanoid.WalkSpeed = 16
table.remove(plrs)
end
end
sph:Destroy()
wait(8)
db = true
end)
It is line 34 I need help with.

2 comments
You have to loop through the table with a for loop, and set the walkspeed that way.
Thanks