This is my code, I want to obtain the player that clicked the textbutton, but its not working. Help?
function Dialog(player) print("Ere") if player ~= nil then CreateDialog("Are You ok?",player) CreateDialog("Oh god, you're bleeding",player) CreateDialog("What was that?",player) end end script.Parent.TextButton.MouseButton1Click:connect(Dialog)
If this script is a local script, inside the PlayerGui/StarterGui, you can just get the player by doing this:
local player = game.Players.LocalPlayer
Here is an example in your given code:
local player = game.Players.LocalPlayer function Dialog() print("Ere") if player ~= nil then CreateDialog("Are You ok?",player) CreateDialog("Oh god, you're bleeding",player) CreateDialog("What was that?",player) end end script.Parent.TextButton.MouseButton1Click:connect()
Hope this helps, don't forget to accept the answer. It gives us both rep!