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?
COMMUNITY QUESTION
Script that only affects who clicked?
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)
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.

1 comment
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.