I tried, please note I'm using Leaderstats to show points. I'm also using a TextButton.
function test () local pnt = game.Workspace.Points.Value + 1 end script.Parent.MouseButton1Click:Connect(pnt)
Errors:
09:11:35.133 - attempt to call a nil value (x12) 09:11:44.842 - Attempt to connect failed: Passed value is not a function
First of all i don't think you need a function
Make a part and add a click-detector and a script in it
We need to create a leaderstats in the script.
game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder", player) leaderstats.Name = "leaderstats" local Clicks = Instance.new("IntValue", leaderstats) Clicks.Name = "Clicks" end)
Now make another script in the part
Type this in the script
local ClickDetector = script.Parent.ClickDetector ClickDetector.MouseClick:Connect(function(player) local Clicks = player.leaderstats.Clicks Clicks.Value = Clicks.Value + 1 -- See this is the important part, you cant just do Clicks.Value + 1 you need to set it to itself. end)
You can also make it with a tool everytime it gets activated it adds one, but then you need remote functions which you will learn later on.
Closed as Not Constructive by User#32819, moo1210, Ziffixture, and killerbrenden
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?