Player click detection

Good Day,

I am just learning to program with Roblox and having trouble understanding the concept of client/server interaction.

I am trying to detect when a player clicks on a part with a tool so I can do something to the part and or the player.

What I am having issues with is where the code should go, I have an example where the code is on the server and also an example where the code is on the client.

What should I be doing?

well first you need to give the part a “ClickDetector”, once the part has that you can detect when the player clicks on the part simply by putting a script inside of the part and something like

script.Parent.MouseClick:Connect(function(player)
print(“Worked!”,player.Name)
end)