How to create a StringValue on the player

Basiclly the title says it how do I add a StringValue to a player via script
Ik i have to use
Where I want to add StringValue:
Pls help me

	local IntValue ="IntValue")
	IntValue.Value = 0
    IntValue.Name = "Name"
	IntValue.Parent = plr

Hi! I would recommend always using game:GetService on any of the main services.

local Players = game:GetService("Players")

	local IntValue ="IntValue")
	IntValue.Parent = Player

1 question, intavlue is a text value right?

There is no need for that when working on server, it’s mainly useful when working on client and with remotes, etc. In this case, you dont have to get its service.
The code @alphadoggy111 provided will work fine with no errors.

[Yours will work aswell :)]

No, StringValue is text. IntValue will contain numbers, and NumberValue will contain numbers with decimals :slight_smile:

then in this case its a string value i wanna make

the value is different for each player

Why do you want to create a StringValue on/under the player?

I’m confused - what are you trying to represent with each IntValue?

You say you want a different value for each player, but you haven’t gone in depth on what you want that value to actually represent.

I jst want to make a value that is different for each player.
For example: I want to make a value that states the Nickname of the player

??? Still doesn’t contradict my statement.

You could just name that value in the Player’s name :

	local IntValue ="IntValue")
	IntValue.Parent = Player
    IntValue.Name = Player.Name 
    IntValue.Value = Player.UserId

Why not use attributes for that?

    player:SetAttribute("Nickname", "default value")

I would think it’s much simpler than managing instances.

I would recommend organising your values in a folder inside the player then. Later you can add even more values if needed! :slight_smile:

local Players = game:GetService("Players")

	local ValueFolder ="Folder")
	ValueFolder.Name = "ValueFolder"

	local ValueNickname ="StringValue")
	ValueNickname.Name = "Nickname"
	ValueNickname.Value = Player.DisplayName
	ValueNickname.Parent = ValueFolder

	-- Add more values if needed!

	ValueFolder.Parent = Player

I would also highly recommend using this over creating values in the players.