Having Problems with making Door clicking system(Client)

Hi Developers so i am making door where is textbutton and texlabel wich will allow you to click till the maxclicks value then door will explode i didnt make the explode system yet i am making textbutton system when you click the Clicks value in the board

This is the local script wich is in startergui’s screengui

local deb = false

local function Deletingdoor(value)
	if deb ~= true then
		deb = true
		value.Parent.Parent.Clicks.Value += 1
		wait(1)
		deb = false
	end
end

local function callingsystem(button)
	button.Activated:Connect(Deletingdoor(button))
end

for i,v in pairs(workspace.Clickboards:GetChildren()) do
	v.SurfaceGui.TextButton.Activated:Connect(callingsystem(v.SurfaceGui.TextButton.Name))
end

Thanks

So what exactly is the problem?

This is the output

Players.hakobmher.PlayerGui.DoorsSystem.LocalScript:6: attempt to index nil with ‘Parent’

I think you have put value.Parent.Parent, I think that the double parent is wrong.

I need to double parent it because the Clicks value is in the clickboard

isn’t this a built in function, shouldn’t the bracket at the end of this be taken away, but also you should have an end after it with close brackets after the end like ‘end)’

Global and local functions do not utilize end) as there is no bracket to close in the operation, so that is not one of the problems.

Oh, so what functions do use ‘end)’, I am actually really confused.

Updated the script some but still not working this is the script now

local deb = false

local function Deletingdoor(value)
	if deb ~= true then
		deb = true
		local a = workspace.Clickboards:FindFirstChild(value)
		a.Clicks.Value += 1
		wait(1)
		deb = false
	end
end

workspace.Clickboards.Clickboard1.SurfaceGui.TextButton.Activated:Connect(Deletingdoor(workspace.Clickboards.Clickboard1))

Output Players.hakobmher.PlayerGui.DoorsSystem.LocalScript:7: attempt to index nil with ‘Clicks’

you can use end) like

part.Touched:Connect(function()
–function
end)

Usually connect functions do, as they have an open bracket that needs to be closed at the end of the operation.

game.Players.PlayerAdded:Connect ( function(Player)

end )

1 Like

oh right, that makes it a lot easier to understand, thanks!!!

1 Like

What is this value you’re setting? Could you show your Workspace so I can see what Clickboards and value are?

ok
This is in workspace for now i have 1 board but to be easier i wanan make the function automatic

Thanks

That must be a local script for it to work and where is the script located?

I’d like to point out though, you may not pass parameters using :Connect(). Instead, do this.

local deb = false

workspace.Clickboards.Clickboard1.SurfaceGui.TextButton.Activated:Connect(function()
	if deb ~= true then
		deb = true
        local value = workspace.Clickboards.Clickboard1
		local a = workspace.Clickboards:FindFirstChild(value)
		a.Clicks.Value += 1
		wait(1)
		deb = false
	end
end)

i said about it at up thanks

aa

Works but not that what i wanted i wanted to make automatic system this system wich you gave i will need to copy paste everytime and change things anyways thanks