Error : Mouse1Click is not a valid member of ServerScriptService
local repStorage = game:GetService("ReplicatedStorage") local remote = repStorage:FindFirstChild("ButtonClick") local button = script.Parent local debounce = false button.Mouse1Click:Connect(function() if not debounce then debounce = true local playerPoint = game.Players.LocalPlayer.leaderstats.Points remote:FireServer(playerPoint) wait(0.01) debounce = false end end)
https://imgur.com/a/uEVsPaA
Your script is fine (i rearranged some things so its a bit more organized)
local repStorage = game:GetService("ReplicatedStorage") local remote = repStorage:FindFirstChild("ButtonClick") local player = game.Players.LocalPlayer local button = script.Parent local debounce = false button.Activated:Connect(function() if debounce == true then return end debounce = true local playerPoint = player.leaderstats.Points remote:FireServer(playerPoint) wait(0.01) debounce = false end)
When you write
local button = script.Parent
make sure this refers to a TextButton or Image Button in a GUI under StarterGui
It seems as if you have used, "Mouse1Click" which isn't a valid property of the mouse.
local repStorage = game:GetService("ReplicatedStorage") local remote = repStorage:FindFirstChild("ButtonClick") local button = script.Parent local debounce = false button.MouseButton1Down:Connect(function() if not debounce then debounce = true local playerPoint = game.Players.LocalPlayer.leaderstats.Points remote:FireServer(playerPoint) wait(0.01) debounce = false end end)