Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

It's not creating a StringValue?

Asked by 7 years ago
Edited 7 years ago

Its supposed to create a StringValue Inside of all Player Character.Its a server script.

local plr = game.Players.Character

local svalue = Instance.new("StringValue", plr)
svalue.Name = "Class"
0
Updated Response Voltoxus 248 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Following from the previous answer, this works:

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        local Value = Instance.new("StringValue", character)
        Value.Name = "Class"
    end)
end)

Just a side note: if you want the value to be preserved after death, you should put the value in the player object rather than the character.

Ad

Answer this question