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

Why does this script not make a Folder and value in a real game?

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)

4 comments

1

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.

1

This also means you don't need a event

0

tysm

0

please accept my answer :)

1 answer

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

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