Okay i know i have only done 1 topic so far and this is my 2nd So here it goes!
I am making a game and i need a fighting system for npc’s but i look up tutorials and it either doesn’t work or seems sketchy .
I got a leaderstats and value set up but i just am not a scripter, Instead i am a Builder
This system relies on the entire Game!
Please give me ideas or a tutorial. I don’t recommend doing scripts but you can put them in if you want. I am thinking about using ai for this but it didn’t work out in the past that well In my other games.
Any help will be super useful and for the other newbies like me use this for help.
i’d Recommend you Create a weapon that “Tags” The NPC so when it dies it knows that “You” Has Killed the “Tagged” NPC and so it knows to give you the cash reward.
this could be done by using a StringValue With the Player’s name As the Value.
Or an ObjectValue With the Player’s Character as the Value.
add a ob i cant say the letter because of my keyboard. obectvalue which sets to the player
variables
when the npc dies
check for the tagger in game.Players, return if the value is non existent or nil
idk panic search probably
DO NOT DO
in the weapon give cash when it killed a monster
worst mistake of my LIFE!!!
anyways
code:
-- when the monster IS DEAD :rofl: --
Humanoid.Dead:Connect(function()
local TagValue = Humanoid:FindFirstChild('Creator') -- hit value.
if not TagValue then return end if TagValue.Value == nil then return end
-- check for the player thro the value of TagValue and give them their leaderstats
end)
linked sword already has a tag script, in short delete the tag and replace it if it has been found and if it isnt from the guy who attacked the monster
otherwise if there isnt a tag make one and set the value with the player