I know this should be on youtube but a lot of it doesn’t seem to work properly for me.
How do I make a script that makes a gun shoot and be able to kill a Zombie that will give me a currency?. (sorry if I ask for a lot I have had some breakdowns from scripting and it not working for some stupid reason)
1 Like
Easy all you need to do is:
- Add a script
- define the humanoid
- define the creator tag inside the humanoid
- define the leaderstats inside such tag
- find the money numbervalue inside leaderstats and add money unto it
Simple and easy! Script Example
what is the “creator tag” inside the humanoid?
Here a great explanation from the devforum!
ok but the thing is that the script don’t work for me AGAIN, for some reason.
here is the script:
local Humanoid = script.Parent.Humanoid
function Dead()
local tag = Humanoid:FindFirstChild("creator")
if tag ~= nil then
local leaderstats = tag.Value:FindFirstChild("leaderstats")
if leaderstats ~= nil then
leaderstats.logs.Value = leaderstats.logs.Value +5
wait(0,1)
script:remove()
end
end
end
Humanoid.Died:Connect(Dead)
I don’t understand why the script don’t work when I kill the Zombie.
Video:
robloxapp-20220225-1106127.wmv (3.5 MB)
The script doesn’t give me a bigger currency. For example: I have 0 logs and I kill a zombie for 1 logs.