Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does my script not print the player name?

Asked by 5 years ago

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!

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 SerpentineKing 3885 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago

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)
Ad
Log in to vote
0
Answered by 5 years ago

LocalScript INSIDE your button.

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

Answer this question