hi everyone, so i made this click-detector, but it wont add points. This script is in a normal script in serverscriptservice:
game.Players.PlayerAdded:Connect(function(player) print("LeaderStats") local stats = Instance.new('IntValue', player) stats.Name = 'stats' print("Stats") local IQ = Instance.new("IntValue", stats) IQ.Name = "IQ" IQ.Value = 0 end)
This is a script inside of a tool in the starterpack:
script.Parent.Parent.Equipped:Connect(function(mouse) mouse.Button1Down:Connect(function() print ("clicked") IQ.Value = IQ.Value + 1 end) end)
In the output it says that IQ is not defined... how do i allow the localscript to use a local from the serverscriptservice?
Read up on more lua. The way I’ll do it is create an IntValue that represents the leaderboard stat and that value has to be somewhere parented under player so you can get it. Also since it’s FE you cannot change anything within a localscript so make a RemoteFunction to do that