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

Why does my script not print the player name?

Hi,

I have a simple imageGui script that is intended to print the clicker's name when he or she clicks the button. However it does not print anything when clicked.

local player = game:GetService("Players").LocalPlayer

script.Parent.ImageButton.MouseButton1Down:Connect(function() print(player.Name.." clicked the green play button") end)

Help would be apprieciated

Thanks!

1 comment

0

try, Activated:Connect(function() instead of the MouseButton1Down:Connect(function() also, make sure you're using a LocalScript and not a regular Server Script

2 answers

Try this in a LocalScript ofc,

local player = game.Players.LocalPlayer

script.Parent.ImageButton.MouseButton1Click:Connect(function()
print(player.Name .. " has clicked the button")
end)

LocalScript INSIDE your button.

local Player = game.Players.LocalPlayer
script.Parent.MouseButton1Down:Connect(function(Print)
print(Player.Name.. "has clicked the button!")
end)

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