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

MouseButton1click is not a valid member of TextButton?

I wanted to make it so that when I click on the button, I have one value added to the leaderstats, but I failed Here is my code: local plr = game.Players.LocalPlayer

script.parent.MouseButton1click:Connect(function() plr.leaderstats.Clicks.Value = plr.leadestats.Clicks.Value +1 end)

9 comments

0

Where is the script located?

0

ServerScriptService

0

Your local script has to be in a TextButton. Not really sure but try to capitalize c (MouseButton1Click)

0

Put this script inside the textbutton and Capitalize the 'C' in MouseButton1Click.

0

It worked, but there was a new error "leadestats is not a valid member of Player"

0

You spelled it wrong. It's leadeRstats

0

plr.leaderstats.Clicks.Value +1

0

Thanks, it worked

0

Nice, I would appreciate it if you marked my answer as your solution. That way the thread will be closed and people won't get confused.

1 answer

The p has to be capitalized and the c in MouseButton1Click. And I made it MouseButton1Down so people on mobile can click it.

local plr = game.Players.LocalPlayer

script.Parent.MouseButton1Down:Connect(function()
   plr.leaderstats.Clicks.Value = plr.leaderstats.Clicks.Value + 1
end)

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