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)
local clicker = script.Parent.ClickDetector function clickDetect(playerWhoClicked) local duckie = playerWhoClicked.Name print(duckie) if game.Workspace:FindFirstChild(duckie) then print(":)") else print(":(") end end clicker.MouseClick:Connect(clickDetect)
The problem was playerWhoClicked
refers to an object. print()
commands refer to a string in it's attribute, not an object.
Regards, Vivilian9