I use it like this
local GoldButton, state = script.Parent.GiveFrame.GoldButton, false
GoldButton.MouseButton1Down:connect(function(player#(=game.Players.Player that clicked)#)
local PRV = player#(=game.Players.Player that clicked)#.refill.Reff
if state == false then
state = true
if PRV.Value == 0 then
wait()
PRV.Value = 1
else
PRV.Value = 0
end
else
state = false
end
end)
or when click on parts
local door = script.Parent
local CursorId = "3190239131"
local ClickDetector = Instance.new("ClickDetector")
ClickDetector.Parent = door
ClickDetector.MaxActivationDistance = 15
ClickDetector.CursorIcon = "rbxassetid://"..CursorId
ClickDetector.MouseHoverEnter:Connect(function()
end)
ClickDetector.MouseHoverLeave:Connect(function()
end)
ClickDetector.MouseClick:Connect(function(player#(player that clicked or part that they need to click on)#)
end)
ClickDetector.RightMouseClick:Connect(function(player)
end)
Del the #.....# parts they are just explaining