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

Value not changing.What to do?Really not working!

Is there any problems or is it just roblox slow?

Script:

local poopcount = script.Parent.Parent.TextLabel.Value
local button = script.Parent
if button.MouseButton1Click
then
	poopcount + 1
end

i want to make that when i press the button the value goes up by 1. im using script should i use local script?

3 comments

0

Not working both

0

btw im new to lua coding

0

I don't think it is the script then.

3 answers

local poopcount = script.Parent.Parent.TextLabel.Value
local button = script.Parent
button.MouseButton1Click:Connect(function()
    poopcount = poopcount + 1
end)

2 comments

0

The button.MouseButton1Click is a function that activates when a player clicks on the button. 1 is added to the "poopcount" value

0

i will try it

Lua, does not understand what to do with Poopcount + 1

You need to set it equal to itself :)

poopcount = poopcount + 1

If there are any questions comment again :)

1 comment

0

Not working :(

First off, You cannot add increments (value) to a TextLabel Second, Value isn't a property of TextLabel Third, I don't think you can track MouseButton1Click with a conditional statement (Not in this case), so I added that event for you. Please try this

local poop = 0 -- I set a value
local poopcount = script.Parent.Parent.TextLabel
local button = script.Parent

button.MouseButton1Click:connect(function()
	poop = poop + 1
	poopcount.Text = tostring(poop) -- to string makes it a string (a word)
end)

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