I was confused on where exactly this “player” is that is taken down when a new player joins. Where does the “player” go and how exactly do I make it go into the player’s username in the Players default folder? Is that the best place to put it?
game.Players.PlayerAdded:Connect(function(player)
local folder = Instance.new("Folder")
folder.Name = "BoolValues"
folder.Parent=player
local value = Instance.new("BoolValue")
value.Name = "ChillBool"
value.Parent = folder
value.Value=false
end)
It’s best to put it in ServerScriptService since this is a script that handles the PlayerAdded event.
This function fires when a new player joins, so each player will have a folder of BoolValues in them. You already have a player parameter, so the parameter defines the player who had joined.
Also, what do you mean by making it go into the player’s username in the Players default folder?
I think he means where the folder would go into the player. Yes, the script would go in ServerScript, but the folder would go into the players backpack when they join.
You know, you could just put the folder in the player by just doing folder.Parent = player so then it would just put the folder in the player, basically like the one in your picture.
It doesn’t go into starter pack. it goes under the default backpack roblox assigns when you join the game. Whatever is in the Starter Pack would replicate to this.
I’m making a checker to see if a player is in my group. Since yesterday from what I posted, this has been what it has been led up to. You can see the other post here.
I think leaderstats would be a great way to do that.
All unnecessary functions in this game (backpack,leaderboards, etc.) have been hidden
Hmmm, if it’s not working, this may be a solution but I’m not so sure.
script:
function playerAdded(player)
local folder = Instance.new("Folder")
folder.Name = "BoolValues"
folder.Parent = player
local value = Instance.new("BoolValue")
value.Name = "ChillBool"
value.Parent = folder
value.Value = false
end
game.Players.PlayerAdded:Connect(playerAdded)
for _,player in pairs(game.Players:GetPlayers()) do
spawn(function() playerAdded(player) end)
end
If you are trying to make a system to check to see if the player has a certain rank in your group or is in your group, you would make a folder parented to the players backpack.
Alright I think it’s a good idea to rewrite the beginning of the script bc it’s gotten pretty bad. I’ll start with your example, @Koriyoc
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local ChillBool = Instance.new("BoolValue")
ChillBool.Name = "ChillBool"
ChillBool.Parent = leaderstats
ChillBool.Value=false
end)
local remoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("ChillRemoteEvent")
local Chill = false
local inGroup = false
print("Starting first check")
print("Starting check to see if player is in group")
print ("Player is in Weird Games, Inc.!" )
inGroup = true
else
print("First check to see if player was in group failed. Trying 10 times, once every second, to see if they are really in the group")
for count = 1,10,1 do
wait(1)
if newPlayer:IsInGroup(6967967) then
print ("Player is in Weird Games, Inc.!" )
inGroup = true
end
end
end