im trying to make a medkit script for a friend, but i encountered an issue
when i try to see if the player is clicking themselves it just returns the part that is directly through them, is there any way i could avoid this issue, if so how?
im trying to make a medkit script for a friend, but i encountered an issue
when i try to see if the player is clicking themselves it just returns the part that is directly through them, is there any way i could avoid this issue, if so how?
Difficult to help when there’s no script etc and not much explaining…
I’m guessing you have raycast with your character in blacklist as this would indeed return the part on the other side of your character.
If you want to be able to click your own character and manually handle what should happen when your character is clicked, you need to take it out of the blacklist in the raycast and then you can check the raycastresult.Instance.Parent == myCharacter.
If this doesn’t help you then I can’t really help without the code you’ve written so far
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local tool = script.Parent
mouse.Button1Down:Connect(function()
print(mouse.Target)
end)
if you run this code inside of a tool, you wont be able to click on the character model as it will just return the part directly through it
The mouse object blacklists the local player from the mouse by default, and I don’t think you can stop that from happening
You’d have to use workspace:Raycast instead