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

MouseButton1click is not a valid member of TextButton?

Asked by 3 years ago

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)

0
Where is the script located? Soban06 410 — 3y
0
ServerScriptService LinoBixYT 0 — 3y
0
Your local script has to be in a TextButton. Not really sure but try to capitalize c (MouseButton1Click) Mafincho 43 — 3y
0
Put this script inside the textbutton and Capitalize the 'C' in MouseButton1Click. Soban06 410 — 3y
View all comments (5 more)
0
It worked, but there was a new error "leadestats is not a valid member of Player" LinoBixYT 0 — 3y
0
You spelled it wrong. It's leadeRstats Mafincho 43 — 3y
0
plr.leaderstats.Clicks.Value +1 Mafincho 43 — 3y
0
Thanks, it worked LinoBixYT 0 — 3y
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. Mafincho 43 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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)
Ad

Answer this question