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

Why is this script only working in the stuido and not the actual game?

local distance = 2000
local function locate(plr)
	local far = (script.Parent.Position - plr.Character:FindFirstChild("Torso").Position).Magnitude
	if far < distance then
		script.Parent.CFrame = CFrame.new(script.Parent.Position,plr.Character:FindFirstChild("Torso").Position)
	end
end
local function find()
local plrs = game.Players:GetPlayers()
	for i = 1,#plrs do
		local plr = plrs[i]
		locate(plr)
	end
end
while true do
	wait(.1)
find()
end

This code works in the studio but not in game. Why would this be?

1 answer

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