Hello. I'm working on my game and want my NPCs to assist the player if there is not a sufficient amount of players. This will require for input interaction between a NPC and part. I was just wondering if such a thing was possible and what events would be required if it is possible. BTW: THIS IS NOT A REQUEST @incapaz :/
No, not directly. It is possible to emulate the ClickDetector being clicked using BindableEvents. I would just add a listener for the bindable event in the script with the click detector. Then when the NPC "decides" to help the player, it could fire the event with the player argument as NPC
or something. Example code below.
Part Script:
function PartClicked(plr) if plr == "NPC" then -- Optional if you want to change what happens when a bot clicks it --Do stuff else --Real player clicked it --Do stuff end end event.OnEvent:Connect(PartClicked) clickDetector.MouseClick:Connect(PartClicked)
NPC Script:
function HelpPlayer() event:Fire("NPC") end
I hope my answer helped you, if it solved your problem, please remember to mark it as correct!