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

Why does my script work solo, but not with multiple people?


local frame = script.Parent
local httpService = game:GetService('HttpService')
local template = script.Parent:WaitForChild('Template')
local tableOfPlayers = game.ReplicatedStorage.Values.TableOfPlayers
local decoded = httpService:JSONDecode(tableOfPlayers.Value)
local inRound = game.ReplicatedStorage.Values.InRound


local function checkForTable(table_, value)
	for i, v in pairs(table_) do
		if v == value then
			return true
		else
			return false
		end
	end
end

inRound.Changed:Connect(function()
	if inRound.Value == false then
		script.Parent.Visible = false
	else
		script.Parent.Visible = true
	end
end)

local cor = coroutine.create(function()
	while true do
		for i, plr in pairs(game.Players:GetPlayers()) do
			if checkForTable(decoded, plr.Name) and plr.ListedOnHealth.Value == false then
				local newTemp = template:Clone()
				newTemp.Name = plr.Name
				newTemp.Visible = true
				newTemp.Parent = table
			elseif not checkForTable(decoded, plr.Name) and plr.ListedOnHealth == true then
				local frame = script.Parent:FindFirstChild(plr.Name)
				frame:Destroy()
			end
		end
		print(decoded)
		wait(0.01)
	end
end)
coroutine.resume(cor)

I can't find the problem. Any help would be appreciated. this is a local script

1 comment

0

Did you test it in studio

4 answers

The only reason why your script works solo, is because that it's a LOCAL script. It happens only on the LOCAL player, that runs the script. You should be able to solve this by copying your code, and pasting it into a regular script in ServerScriptService or Workspace. OR you could just enable API Servers.

make sure you have enabled all services and use a normal script and Published your place.

2 comments

0

it's in a local script

0

tryna with normal script

Make sure it's not a local script and enable API servers. Or just test it in game.

1 comment

0

if it's a local script how would i change it?

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