Script not working in roblox like it does in roblox studio

  1. I want to make this work in roblox like it does in studio

  2. I have a proximity spawn that i am making for a friend with a folder in workspace, a folder in server storage and a script to move the character models between both of them based on the character’s location, it doesnt work in the Roblox app but it does in studio

  3. I dont know what to do about it can u guys help?

local radius = 25

while wait(2) do
	for i, plr in ipairs(game.Players:GetChildren()) do
		for i, v in ipairs(game.ServerStorage.DisactivatedEntities:GetChildren()) do
			if (v.PrimaryPart.Position - plr.Character.HumanoidRootPart.Position).Magnitude < radius then
				v.Parent = game.Workspace.SpawnedEntities
			end
		end
		for i, v in ipairs(game.Workspace.SpawnedEntities:GetChildren()) do
			if (v.PrimaryPart.Position - plr.Character.HumanoidRootPart.Position).Magnitude >= radius then
				v.Parent = game.ServerStorage.DisactivatedEntities
			end
		end
	end
end

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

it could be because you’re using the same variables for each loop, which isnt picking up anything

change it up to

for a, plr

and

for b, v

and

for c, v2

no, its not because that variable is not global