I have a script located in the startergui and it if you kill the npc you earn gold. I have a saving currency. Heres script:
local player = script.Parent.Parent local leaderboard = player:WaitForChild("leaderstats") local currency1 = leaderboard:WaitForChild("Gold") function onDied() print("Dead") currency1.Value = currency1.Value + 100 end script.Parent.Parent.Workspace.TutPrac.Viking.Humanoid.Died:connect(onDied)
thanks!
I guess do it like:
local player = game.Players.LocalPlayer local human = player.Character.FindFirstChild("Humanoid") local helt = human.Health if helt == 0 then print 'He ded.' end
^^ Should do the trick, if not then im sorry.
-TheArcticTerminal
local player = script.Parent.Parent local leaderboard = player:WaitForChild("leaderstats") local currency1 = leaderboard:WaitForChild("Gold") while wait(0.1) do if workspace.TutPrac.Viking.Humanoid.Health <= 0 then print("Dead") currency1.Value = currency1.Value + 100 script:remove() end end