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

Why isn't my script adding stuff under the player?

Making some stuff for a tycoon, and I'm placing some stuff under the player, but it's not working?

I have this script in StarterPlayerScripts

local Player = game.Players
local LPlayer = Player.LocalPlayer

function OnPlayerAdded()
	wait(1)
	local Container = Instance.new("Folder")
	Container.Parent = LPlayer
	local Owner = Instance.new("StringValue")
	Owner.Parent = Container
	Owner.Value = LPlayer.Name
end

Player.PlayerAdded:Connect(OnPlayerAdded)

1 comment

0

Can you tell us your goal, as well as the Script type?

1 answer

✓ Accepted answer

You should create the values inside of a server script, also I don't think you can use playeradded in a localscript.

function OnPlayerAdded(player)
	wait(1)
	local Container = Instance.new("Folder")
	Container.Name = "Container"
	Container.Parent = player
	local Owner = Instance.new("StringValue")
	Owner.Name = "Owner"
	Owner.Parent = player
end

game.Players.PlayerAdded:Connect(OnPlayerAdded)

1 comment

0

k thanks

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