I want to make a button (inside the surfacegui) that defines player who clicked it.
This is the script so far.
script.Parent.MouseButton1Click:Connect(function()
-- Yeah i don't know how to define it.
game.ReplicatedStorage.RemotesPrompt.Robux1:FireClient(--Player)
end)
2 Likes
Noskur2
(Noskur2)
October 3, 2020, 1:19am
#2
script.Parent.MouseButton1Click:Connect(function(player)
– Yeah i don’t know how to define it.
game.ReplicatedStorage.RemotesPrompt.Robux1:FireClient(player)
end)
I think that should work
Nope, It doesn’t work, but nice try tho
Noskur2
(Noskur2)
October 3, 2020, 1:23am
#4
Try using a click ClickDetector
Aeventy
(Aeventy)
October 3, 2020, 1:24am
#5
Uh, sorry but that doesn’t work. I don’t need to test it to know that…
Noskur2
(Noskur2)
October 3, 2020, 1:24am
#6
script.Parent.MouseClick:Connect(function(plr)
print(plr.Name)
end)
Is there any way to change the design of the mouse on the click detector? (I don’t like it)
ram4c
(ram4c)
October 3, 2020, 1:28am
#13
I’m confused, are you looking for the name of the player who clicks the button?
I mean its a textbutton INSIDE surfacegui.
No. Its a textbutton not in any startergui. Its inside a part
ram4c
(ram4c)
October 3, 2020, 1:32am
#19
Try
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
print(player.Name)
end)
Noskur2
(Noskur2)
October 3, 2020, 1:33am
#20
Just make a invisible part above the textbutton and use
script.Parent.MouseClick:Connect(function(player)
end)
No. It works on clicking, but I dont know how to define a player
Noskur2
(Noskur2)
October 3, 2020, 1:38am
#22
What do you mean define a player? You can’t really create a new player
you can respawn them though
ram4c
(ram4c)
October 3, 2020, 1:38am
#23
Please try this.
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
print(player.Name)
end)
ethswan
(ethswan)
October 3, 2020, 1:38am
#24
What you can do is do
local player = game.Players.LocalPlayer
local plr = game.Players:GetPlayerFromCharacter(player.Character)
print(plr.Name)
(not 100% sure if it will work but try)
Noskur2
(Noskur2)
October 3, 2020, 1:40am
#25
They are using a surface gui which can not hold localscript since they are located in workspace
Noskur2
(Noskur2)
October 3, 2020, 1:41am
#26
This is your best bet I suggest you use it