Ad
Log in to vote
-2

How do i instance a intvalue? [closed]

Asked by
reloce 0
7 years ago

im trying to make an rpg and for the exp i am using and intvalue and i cant seem to get it to go into the player

game.Players.PlayerAdded:connect(function() local expe = Instance.new("IntValue") expe.Parent = game.Players.LocalPlayer expe.Value = 0

end)

0
its actually more organized than that i dont know what happened reloce 0 — 7y

Locked by TheeDeathCaster, Redbullusa, and BlueTaslem

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

3 answers

Log in to vote
1
Answered by 7 years ago

Remember, LocalPlayer can only be accessed by a LocalScript, and you have another error; Other then the LocalPlayer, you left out something in your PlayerAdded event; the Player, you forgot to specify the Player in the function/event, let's fix up your script;

game.Players.PlayerAdded:connect(function(plr) --'plr' here will specify the Player that has joined the server/game
local expe = Instance.new("IntValue") --Correct; this will create a new Instance [in this case, it will create the IntValue]
expe.Parent = plr --This will set the Parent of 'expe' to 'plr' [the Player]
expe.Value = 0 --This will set 'expe''s Value to 0
end) --This ends the code block for the event/function

Hope this helped!

Ad
Log in to vote
0
Answered by 7 years ago
    game.Players.PlayerAdded:connect(function() local expe = Instance.new("IntValue") expe.Parent =                     game.Players.LocalPlayer expe.Value = 0

end)

To organize a Script, you need to put Code Blocks in, or press the Lua button before answering or making a post, the one in a blue bubble.

As for your question.. it looks right to me, but I can't be sure.

Log in to vote
-1
Answered by
reloce 0
7 years ago

it still didnt work, this is the exact code i used in a regular script

game.Workspace.Players.PlayerAdded:connect(function(plr)
    local expe = Instance.new("IntValue")
    expe.Parent = plr
    expe.Value = 0
end)
0
Remove ".Workspace" Discern 1007 — 7y