So when a player joins it should create a new folder and values inside that folder. But when i create a new server it doesn't do that why? Server Script
local removeEvent = game.ReplicatedStorage.PlayerTo game.Players.PlayerAdded:Connect(function(player) removeEvent:FireClient(player) end)
** Local Script **
local replicatedStorage = game:GetService("ReplicatedStorage") local event = replicatedStorage:WaitForChild("PlayerTo") event.OnClientEvent:Connect(function() local NewFolder = Instance.new("Folder") NewFolder.Parent = game.Workspace.Stat NewFolder.Name = game.Players.LocalPlayer.Name local PointValue = Instance.new("NumberValue") PointValue.Value = 0 PointValue.Name = "Points" PointValue.Parent = NewFolder local AssistValue = Instance.new("NumberValue") AssistValue.Value = 0 AssistValue.Name = "Assists" AssistValue.Parent = NewFolder end)
Put all the folder making stuff in the server script and then just remove the local. Adding a folder to the player cannot be done and shown to the whole server if you are using a local script I think. This also means you don't need a event
-- server side
game.Players.PlayerAdded:Connect(function(player) local NewFolder = Instance.new("Folder") NewFolder.Parent = game.Workspace.Stat NewFolder.Name = player.Name local PointValue = Instance.new("NumberValue") PointValue.Value = 0 PointValue.Name = "Points" PointValue.Parent = NewFolder local AssistValue = Instance.new("NumberValue") AssistValue.Value = 0 AssistValue.Name = "Assists" AssistValue.Parent = NewFolder end)
If I were you I would put the folder in the player in players them self and not workspace, but that's your choice