Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Finding player in a regular script help?

Asked by
NotSoNorm 777 Moderation Voter
9 years ago

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

Log in to vote
0
Answered by
funyun 958 Moderation Voter
9 years ago

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)
0
Because I made the boolvalue appear when they join, I'd have to someone make a script and put it in? NotSoNorm 777 — 9y
Ad

Answer this question