So , i’m searching to make a NPC that i control . So like if press the Z key and if my mouse was on an entity humanoid he will walk to him and kill him . I already try to make it but i dont know how to know when the mouse is on an humanoid and how to say to the NPC to walk to him and kill him in the SS Script . So if u knwo help me pls :c
Make an NPC Attack and an other Npc when i press a key and my mouse was on the NPC that i want to be killed
These are just some links to help you, you’d want to detect what object you are hitting and if it’s within the range you are looking for. Then go through and detect whether or not it’s an npc and allow the player to hit Z to attack. These are more-so straight forward and simple ways to achieve what you are looking for. Now this will all be client sided so fire the server with a RE telling it you want to attack. On the server check the distance of the two and make sure they can attack whatever it is. Then proceed and do everything.
What is a Re telling i dont understand that part … :c
I know how to make him move and all the only thing i dont understand is how i’m suppose to detect if my mouse is on an humanoid or not
Target is what BasePart the mouse is pointing at
if (mouse.Target and mouse.Target.Parent:FindFirstChild("Humanoid")) then -- Do something end
You seem to be asking for code to be written for you just like that, that is not how stuff works, you should be making some kind of attempt, try looking at roblox tutorials, they can be of help. @Lua_Basics gave you some useful links that you should really go to.
I’m not searching for something done lol . I’m just asking to what you give me because i didn’t find a way to know where the mouse was pointing . I already made 50% script … So thanks you for your help and your time
RE = Remote Event, sorry for the confusion.
np men you helped me too So dont worry
may i ask how much your script can do so far?
How do you want me to show you that ?
Screenshot / copy paste. I merely want to know what code you already have payed down since what your asking for does sound like a whole script and im intrested in what you will be building the requested code into
Lol i’m not gonna give my code x) But i can show you some sneak peak of what it does
ok that would be sufficient
https://gyazo.com/27f3483aaeb90bb330c41f9cdc3e4e67 they can attack
https://gyazo.com/58405c2adb3c18fd5fb7ea46613e8de2 they can Spawn
Both animations very nice however I would probs suggest adding effects
yay thats not really finished but thx u
If your problem is solved, click the check-mark underneath the post that solved it. It makes it easier for people to tell whether you still need help or not.
if (mouse.Target and mouse.Target.Parent:FindFirstChild(“Humanoid”)) then
– Do something
I’m just curious, why do you use "( ) "
if mouse.Target and mouse.Target.Parent:FindFirstChild("Humanoid") then
do the same?