The held object is supposed to add 1 to the leaderboard but it says that "Subscriber is not a valid member of Folder". Here is the script for that: ~~~~~~~~~~~~~~~ local Subscriber = game.Players.LocalPlayer.leaderstats.Subscriber.Value -- Model should be named "leaderstats"
function GiveSubscribers()
Subscriber = Subscriber + 666
script.Parent.Parent:Remove()
end
script.Parent.MouseClick:connect(GiveSubscribers)
The leaderboard script is this:
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player
local money = Instance.new("IntValue",leaderstats) money.Name = "Subscribers" money.Value = 0
end) ~~~~~~~~~~~~~~ Please help me fix this!
I believe the problem is that you call the leaderstat Subscribers with an s at the end when you create it, but when you try to alter it you do not include the s. As well as this, if you set a variable to the value of something, you cannot update that value through the variable. Instead, you should do something like this:
local Subscriber = game.Players.LocalPlayer.leaderstats.Subscribers --remember the s function GiveSubscribers() Subscriber.Value = Subscriber.Value + 1 end
As well as this, you should use :Destroy() instead of :Remove(), as remove is deprecated. You should also format your code inside code blocks (the Lua symbol) when asking questions in the future.