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

Changing an IntValue on click and repeatedly checking to see if player has gamePass- Help?

Asked by 9 years ago

I am making a script where when the player clicks the textbutton the intValue's value goes up by the upgrade (another intValue with the second script in it). The click script is here, and the output is: attempt to index global 'script' (a nil value)

upgrade = script.Parent.Parent.TextLabel.Upgrade -- this is a local script
number = script.Parent.Parent.TextLabel.Number

script.Parent.MouseButton1Click:connect(function()
    number.Value = ""..number.Value + upgrade.Value
end)

This script is in an IntValue(not the textButton like above) and the IntValue is a child to a textlabel. The ouput is: attempt to index local 'player' (a nil value)

local pass = 182358984 -- this is not a local script
local player = game.Players.LocalPlayer

function Auth(player)
    return game:GetService('GamePassService'):PlayerHasPass(player.UserId, pass)
end

while true do
    if Auth() then
        script.Parent.Value = 3
    else
        script.Parent.Value = 1
    end
end

if you could answer one that would be good too.

0
Is the second script a localscript? ChipioIndustries 454 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

"game.Players.LocalPlayer", You can only do that in a LocalScript.

Ad

Answer this question