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

I got an error on my clicker game, what i have to do?

Asked by 6 years ago
Edited 6 years ago

Error : Mouse1Click is not a valid member of ServerScriptService

01local repStorage = game:GetService("ReplicatedStorage")
02local remote = repStorage:FindFirstChild("ButtonClick")
03 
04local button = script.Parent
05 
06local debounce = false
07 
08button.Mouse1Click:Connect(function()
09    if not debounce then
10        debounce = true
11        local playerPoint = game.Players.LocalPlayer.leaderstats.Points
12        remote:FireServer(playerPoint)
13        wait(0.01)
14        debounce = false
15    end
16end)

https://imgur.com/a/uEVsPaA

0
What do you do with the 'playerPoint' you send to the server? You should only tell the server that they clicked. Not send a current value of something to be added. You risk the client exploiting the amount here. xPolarium 1388 — 6y
0
Also 'Mouse1Click' isn't an event for any object in Roblox. I'm assuming you mean 'MouseButton1Click' for a GuiButton: https://developer.roblox.com/api-reference/event/GuiButton/MouseButton1Click xPolarium 1388 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Your script is fine (i rearranged some things so its a bit more organized)

01local repStorage = game:GetService("ReplicatedStorage")
02local remote = repStorage:FindFirstChild("ButtonClick")
03local player = game.Players.LocalPlayer
04 
05local button = script.Parent
06 
07local debounce = false
08 
09button.Activated:Connect(function()
10    if debounce == true then return end
11    debounce = true
12        local playerPoint = player.leaderstats.Points
13        remote:FireServer(playerPoint)
14        wait(0.01)
15    debounce = false
16end)

When you write

1local button = script.Parent

make sure this refers to a TextButton or Image Button in a GUI under StarterGui

Ad
Log in to vote
1
Answered by 6 years ago

It seems as if you have used, "Mouse1Click" which isn't a valid property of the mouse.

01local repStorage = game:GetService("ReplicatedStorage")
02local remote = repStorage:FindFirstChild("ButtonClick")
03 
04local button = script.Parent
05 
06local debounce = false
07 
08button.MouseButton1Down:Connect(function()
09    if not debounce then
10        debounce = true
11        local playerPoint = game.Players.LocalPlayer.leaderstats.Points
12        remote:FireServer(playerPoint)
13        wait(0.01)
14        debounce = false
15    end
16end)
0
This should work, and if it does please accept my answer! MustangHeart 67 — 6y
0
Didn't even notice that, nice work! DesiredRep 75 — 6y
0
Doesn't work... rosebeach -3 — 6y
0
what's the error, and use prints DesiredRep 75 — 6y
0
Yeah, what are the errors? MustangHeart 67 — 6y

Answer this question