Hi i have been trying to figure this out but i cant. I am making a rpg game and i wanted to know how to make it so that when someone gets defeated in the game they lose thier money AND thier exp. thanks for any help its appreciated!
Hello, I saw this and decided to help you out (: I am not really that great on explaining things, so if it gets hard, then PM me.
Now, as far as I can understand your question, I think I get what your asking for. BUT, if I am wrong, then PM me so I can script the correct thing for you!
First, go to the game you are working on in Studio and open up Workspace. Right click Workspace > Insert Script. [NOT LOCALSCRIPT].
Rename that script to "Money/Exp Loss"
Now, inside of that script insert this :
local Humanoid = script.Parent.Humanoid function PwntX_X() local tag = Humanoid:findFirstChild("creator") if tag ~= nil then if tag.Value ~= nil then local Leaderstats = tag.Value:findFirstChild("leaderstats") if Leaderstats ~= nil then Leaderstats.Currency.Value = Leaderstats.Currency.Value + 0 --Change Currency to Your Money wait(0.1) script:remove() end end end end Humanoid.Died:connect(PwntX_X) local Humanoid = script.Parent.Humanoid function PwntX_X() local tag = Humanoid:findFirstChild("creator") if tag ~= nil then if tag.Value ~= nil then local Leaderstats = tag.Value:findFirstChild("leaderstats") if Leaderstats ~= nil then Leaderstats.XP.Value = Leaderstats.XP.Value + 0 --Change XP To your Experience Name wait(0.1) script:remove() end end end end Humanoid.Died:connect(PwntX_X)
If this is NOT what you were looking for, then please PM me so I can help you out with what you were wanting.
If this was it, then I am glad I could help (: