Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does this click script not work? [BlueTaslem please answer]

The error for the script is: local player = game.Players.LocalPla:3: attempt to index global 'script' (a nil value) If you're wondering, number is a stringValue and upgrade is an IntValue.

local pass = 182358984
local player = game.Players.LocalPlayer
upgrade = script.Parent.Parent.TextLabel.Upgrade
number = script.Parent.Parent.TextLabel.Number

function Auth(player)
	return game:GetService("GamePassService"):PlayerHasPass(player, pass)
end

script.Parent.MouseButton1Click:connect(function()
	if Auth() then
		upgrade.Value = 3
	else
		upgrade.Value = 1
	end
	number.Value = number.Value + upgrade.Value
end)

1 answer

✓ Accepted answer

I don't see why you're getting that error specifically, but there is a bug in this code, specifically the Auth function.

You define Auth with a player parameter, overriding your player local variable for the scope of the function. Then, when you call Auth, you don't pass in any argument.

To fix that, just remove player from the parameter list for Auth.

1 comment

0

I swear nothing works for this script. Can BlueTaslem answer this script please?

This discussion is preserved as it was. New answers, comments, and votes are closed.