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

Help with this IntValue script?

Asked by
Mystdar 352 Moderation Voter
10 years ago
game.Players.PlayerAdded:connect(function(player)
        player.CharacterAdded:wait() --Waits until the CharacterAdded event has fired.
        wait(1)
        local Quest=Instance.new("IntValue") -- New IntValue
        Quest.Parent = player
        Quest.Name = "Quest" --Give a name to the IntValue, so you can easily identify it in other scrip
        Quest.Value=1
    end)

This works and puts a IntValue in the player, but how would I change that IntValue? I'm stuck on the parenting of Quest, bearing in mind it will be Unique for each player. I know I can do this:

Quest.Value=Quest.Value+.1
0
What do you mean by "change"? Relatch 550 — 10y
0
Increase/Decrease it. I'll add to the script. Mystdar 352 — 10y

2 answers

Log in to vote
0
Answered by
Discern 1007 Moderation Voter
10 years ago

I'm not quite sure if this is what you mean, but if you would access it from another script, this would be it:

game.Players.PLAYERNAME:WaitForChild("Quests") --This is accessing "Quests".
0
How would I get the local PLAYERNAME? Mystdar 352 — 10y
Ad
Log in to vote
0
Answered by
Relatch 550 Moderation Voter
10 years ago

This is fairly simple.

Quest.Value = Quest.Value + 1 --Add

Quest.Value = Quest.Value - 1 --Subtract

Quest.Value = Quest.Value * 1 --Multiply

Quest.Value = Quest.Value 1/1 --Divide
0
Afraid not. As stated above it is the parenting I am stuck on not the changing of the value. Mystdar 352 — 10y

Answer this question