|
| 19 Aug 2016 07:16 PM |
so i made a script that makes it when you kill a mob you get some exp BUT
when i use uh idk a "spell" i made then it just doesnt count it as your kill
i checked to see if the player killed and in the damage script i dont know whats wrong..
here are both scripts check them out and hep me please. im going on vacation 2morrow so pls.
onexpkill script--
script.Parent.Humanoid.Died:connect(function() local k = script.Parent.Humanoid:FindFirstChild('creator') if k ~= nil then if k.Value ~= nil then local Data = k.Value:FindFirstChild('Data') if Data ~= nil then Data.xp.Value = Data.xp.Value + 25 end end end end)
ondamage script--
enabled = false
function Damage(hit)
local h = hit.Parent:FindFirstChild("Humanoid") if h and not enabled then enabled = true for i = 1,100 do h.Health = h.Health -1 wait(1/15) end end enabled = false end
local wfc = workspace:WaitForChild("s")
wfc.Touched:connect(Damage)
please help me.
i like ducks bro. deal wit it. |
|
|
| Report Abuse |
|
|
error9999
|
  |
| Joined: 05 Sep 2009 |
| Total Posts: 1593 |
|
|
| 19 Aug 2016 08:03 PM |
When are both scripts used?
btw, you never add a "tag" to the humanoid, so it can't detect the "owner" of the kill. |
|
|
| Report Abuse |
|
|
|
| 19 Aug 2016 08:15 PM |
the damamge is when you cast a spell i made.
and mob kill is when you kill a mob and you get exp...
and that cant be it since it works when you use a reg sword...
i like ducks bro. deal wit it. |
|
|
| Report Abuse |
|
|
|
| 19 Aug 2016 08:32 PM |
also whats a tag explain please?
i like ducks bro. deal wit it. |
|
|
| Report Abuse |
|
|
|
| 19 Aug 2016 09:23 PM |
bump
i like ducks bro. deal wit it. |
|
|
| Report Abuse |
|
|
| |
|
error9999
|
  |
| Joined: 05 Sep 2009 |
| Total Posts: 1593 |
|
|
| 20 Aug 2016 06:47 AM |
a tag is a stringvalue inside the monster's humanoid, called "creator" in this case,
you want the player to get exp, but the script inside the humanoid needs this tag to know what player killed this monster. |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2016 08:20 AM |
I see but im pretty sure I did that....
it finds the first child that killed it....
then gives the exp...
i like ducks bro. deal wit it. |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2016 08:59 AM |
DUMP WHOPPS I MEANT BUMP
i like ducks bro. deal wit it. |
|
|
| Report Abuse |
|
|
| |
|
|
| 20 Aug 2016 10:26 AM |
In your damage script, you never add the tag to the humanoid that is being damaged.
Add this line into your damage script after the : local h : line.
local tag = Instance.new("StringValue", h) tag.Value = script.Parent.Parent |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2016 11:13 AM |
Wow, thanks for the advice. Sadly it didn't work.
it says Workspace.s.Damage:11: bad argument #3 to 'Value' (string expected, got Object)
I mean here is how I set up the Damage Script
starterpack -tool --spell(in here it uses bodyvelocity to move a brick called "s" forward) ---damage script
maybe I should do WaitforChild("s")?
I honestly don't know I'm sorry if I am troubling you though.
i like ducks bro. deal wit it. |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2016 12:13 PM |
Honestly You MUST add the tag script in both script
Something like this MAY help
k.Data.xp.Value- etc
|
|
|
| Report Abuse |
|
|
|
| 20 Aug 2016 12:28 PM |
I see.
i like ducks bro. deal wit it. |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2016 12:30 PM |
Can you explain it further?
i like ducks bro. deal wit it. |
|
|
| Report Abuse |
|
|
L2000
|
  |
| Joined: 03 Apr 2008 |
| Total Posts: 77448 |
|
|
| 20 Aug 2016 12:33 PM |
It should be an ObjectValue instead of a StringValue, so replace the local tag = line with this:
local tag = Instance.new("ObjectValue", h)
If you're seeing this post, it means I'm either dead (leaving behind a very fabulous looking corpse) or my soul has been captured by pixies! |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2016 12:40 PM |
@L2
That did clean up the errors and it actually did damage this time. Sadly no EXP.
However, it might be because on the line that says,
tag.Value = script.Parent.Parent
and since when you start a game the backpack is in the Player would I have to parent it to the player or Data.Value?
Thank you guys for all your help btw.
i like ducks bro. deal wit it. |
|
|
| Report Abuse |
|
|
| |
|
|
| 20 Aug 2016 01:29 PM |
Still looking for an answer doe
i like ducks bro. deal wit it. |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2016 04:57 PM |
Bump
i like ducks bro. deal wit it. |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2016 07:33 PM |
Alright last bump before I go to Dominican Republic
i like ducks bro. deal wit it. |
|
|
| Report Abuse |
|
|
L2000
|
  |
| Joined: 03 Apr 2008 |
| Total Posts: 77448 |
|
|
| 21 Aug 2016 05:05 PM |
| The .Parent.Parent might be off. That should point at the player, so it should work if you fix that |
|
|
| Report Abuse |
|
|
|
| 21 Aug 2016 05:20 PM |
you used findfirstchild on k.Value
|
|
|
| Report Abuse |
|
|