So basically I'm trying to make a button that makes the player who clicks it explode. When I tried using the "playerWhoClicked" parameter it returned the correct username. But when I try to use the username to find the player in the Workspace it doesn't work properly. An example of the code I'm using is at the bottom, I haven't put in the explosive stuff yet because I haven't gotten it to work.
local clicker = script.Parent.ClickDetector
function clickDetect(playerWhoClicked)
local duckie = playerWhoClicked
print(duckie)
if game.Workspace:FindFirstChild(duckie) then
print(":)") else
print(":(")
end
end
clicker.MouseClick:Connect(clickDetect)

3 comments
Oh, ok! So using playerWhoClicked.Name converted it into a string which allows us to search in the Workspace?
Yeah, Exactly! With playerWhoClicked being an object in a print command's attribute, that made an error and the script came to a stop.
Awesome, thanks for your help!