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

Script that only affects who clicked?

I need to make a script for my GUI that only works on the one who clicked? What do I do or use? Do I just need to use a localscript?

2 answers

Use local script and here's the ouline of what you need

function onClicked()
 ---Put what you want it to do here
end

script.Parent.MouseButton1Click:connect(onClicked)

1 comment

0

You don't need it to be a local script. It cannot be a local script if the gui is not in the player BTW.

Well, try this:

function Clicked()
	local player = script.Parent.Parent.Parent.Parent -- The player in the 'Players' service.
	-- If  you put the button inside something, add a .Parent to it.

	-- Put your script here
end

script.Parent.MouseButton1Click:connect(Clicked) -- Put this script in the button

I hope that helped!

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