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

Finding player in a regular script help?

So I have a boolian named "AFK" in every character that joins (game.Players.etc...) but this script doesn't read it, how would I fix this, It doesn't give off any errors also.

Spawns = game.Workspace.Spawns
Players = game.Players:GetPlayers()


for PlayerTeleport = 1, #Players do
	if game.Workspace:FindFirstChild(Players[PlayerTeleport].AFK.Value) == false then  
			Players[PlayerTeleport].Character.Torso.CFrame = Spawns[_G.StartingPlaces[math.random(1,#_G.StartingPlaces)]].CFrame * CFrame.new(0,8,0)
		else
		end
end

1 answer

Put this LOCALSCRIPT in the AFK value. That's all I can say.

Spawns = game.Workspace.Spawns
player = game.Players.LocalPlayer
repeat wait() until player.Character
char = player.Character
AFK = script.Parent

AFK.Changed:connect(function()
	if AFK.Value == true then
		char.Torso.CFrame = Spawns[math.random(1, #Spawns:GetChildren())].CFrame * CFrame.new(0, 8, 0)
	end
end)

1 comment

0

Because I made the boolvalue appear when they join, I'd have to someone make a script and put it in?

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