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

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

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

5 comments

0

I don't get what you're trying to do????

0

A point system for when you click something.

0

Oh!

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.

0

Also look at zamdi's answer he helped me too, with my DataStore error!

1 answer

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.

1 comment

0

I have leaderstats in a different script

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