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

How do you make a value go higher on another script? [closed]

Asked by 4 years ago
Edited 4 years ago

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

0
I don't get what you're trying to do???? User#32819 0 — 4y
0
A point system for when you click something. admin4lifenow -6 — 4y
0
Oh! maxpax2009 340 — 4y
0
Then make your question more constructive, and also, this is not a script request site. Try the script for yourself and if gives an error, come back to ask us what is wrong. User#32819 0 — 4y
0
Also look at zamdi's answer he helped me too, with my DataStore error! maxpax2009 340 — 4y

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?

1 answer

Log in to vote
0
Answered by 4 years ago

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.

0
I have leaderstats in a different script admin4lifenow -6 — 4y
Ad