Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a attack give experience?

I was wondering how to make a attack that gives experience and what I need to use to make it, I'm not requesting a script, simply asking what I need to make it

EDIT: The attack is a punch

2 comments

0

What type of attack would this be, a bulet, object hit or anoter form of attack?

0

It would be a punch

2 answers

✓ Accepted answer

As someone that uses experience in multiple games, I'd say you should add it in the script of the attack. Unless of course, you only want them to gain exp if it hits, which is something else. So first off, you will need experience. I'm not sure if you already have it or not, it's rather simple, I'll assume you already have a experience value (add it in leaderboards, or make it inside the player, etc. up to you), but I can help if you wish. So, you'd need to add something like this in your attack;

-- at the beginning
local EXP = game.Players.LocalPlayer.Place -- Just make it be in the correct spot. And note that LocalPlayer ONLY works in local scripts! 

Also, once the attack is set, something like this usually does the trick:

EXP.Value = EXP.Value + 1000 -- set the number

You can be much more efficient and/or fancy about it. I cannot help you that much, as you did not specify what you exactly needed. Feel free to post a script if it's not working. I can try making a script or a description that is more helpful if you require something specific.

I hope I helped! And if I didn't, feel free to tell me what I can do to make it better. Have a good day, XxSHjokerxX

If you are using weapons, there's a part that detect's damage. If your using filtering enabled use things such as events and functions (remote ones). Now if you find a line that deals damage like X.Health = ___- then, add a line like so, Xp Location.Value = Xp Location.Value + 1

AKA; game.players.LocalPlayer.Leaderstats.xp = game.players.LocalPlayer.Leaderstats.xp + 1

2 comments

0

But if you're using the Died event it gives you the person who DIED not the person who KILLED the other person.

0

The item used to deal damage ( i meen somthing like a sword ). Its a local script. It gives you the other players name yes, but thats not needed.

This discussion is preserved as it was. New answers, comments, and votes are closed.