Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Only one of the ClickDetector's work as all the same names in a model. Why?

So, I am making a register and when you click the screen a GUI shows using tweening. However, only one of the computer works. I have all of the registers named 'Register' and I have grouped them all, meaning there is more than one group named 'Register'. I want any of the players to go up to any of the ClickDetector's and for the GUI to show. However, the script will only read one of the computers and you must go to that specific one. I hope you get what I am trying to say here. Here is my code to open the GUI:

local frame = script.Parent
local closeButton = script.Parent.close

--Puts GUI on screen
game.Workspace.Cashier.Register.Screen.ClickDetector.MouseClick:Connect(function(Screen)
	print(Screen)
	script.Parent.Parent.Enabled = true
	frame:TweenPosition(UDim2.new(0.176, 0, 0.151, 0))
end)

local debounce = false
 
--Expands and shrinks GUI
script.Parent.hide_Show.MouseButton1Click:Connect(function()
	if not debounce then
		debounce = true
		frame.Parent.Enabled = true
		if frame.hide_Show.Text == "Hide" then
			frame:TweenPosition(UDim2.new(0.176, 0, 0.868, 0))
			wait(1)
			frame.hide_Show.Text = "Show"
			wait(0.8)
			debounce = false
		elseif frame.hide_Show.Text == "Show" then
			frame:TweenPosition(UDim2.new(0.176, 0, 0.151, 0))
			wait(1)
			frame.hide_Show.Text = "Hide"
			wait(0.8)
			debounce = false	
		end
	end
end)

--close button
closeButton.MouseButton1Click:Connect(function()
	frame:TweenPosition(UDim2.new(0.176, 0, 0.151, 850))
	wait(1.2)
	frame.Parent.Enabled = false
end)

1 answer

don't have many stuff parented to the same instance and named the same thing rename them

1 comment

0

But then the script wouldn't work, unless I copy and pasted it for all of the different registers.

This discussion is preserved as it was. New answers, comments, and votes are closed.