You can get the player using local player and player functions but how do you get it using the mouse? I've tried using Mouse.Target which gets non-living objects but it doesn't get the player. How do i get the player using the mouse?
local mouse = player:GetMouse() local click = false local function onclick() if not click then click = true print(mouse.Target) wait(0.5) click = false end end mouse.Button1Down:Connect(onclick)
This is not a request site!
But luckily it is easy to do with the proper variables and functions.
PUT THIS IN STARTERGUI!.
I worked through your script and i found the solution and you didn't define a variable for player. Another error you had is that you didn't know who to correctly define a OnClick function with a player mouse. Also if you ask me but what i can tell by the script this is poor understanding of code especially when its client sided.
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local click = false local function OnClick() if click == false then click = true print(Mouse.Target) wait(1) click = false end end Mouse.Button1Down:Connect(OnClick)