generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: why isnt it working how i like it to work

Previous Thread :: Next Thread 
superpants2020 is not online. superpants2020
Joined: 10 Feb 2013
Total Posts: 804
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 is not online. 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
superpants2020 is not online. superpants2020
Joined: 10 Feb 2013
Total Posts: 804
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
superpants2020 is not online. superpants2020
Joined: 10 Feb 2013
Total Posts: 804
19 Aug 2016 08:32 PM
also whats a tag explain please?


i like ducks bro. deal wit it.
Report Abuse
superpants2020 is not online. superpants2020
Joined: 10 Feb 2013
Total Posts: 804
19 Aug 2016 09:23 PM
bump


i like ducks bro. deal wit it.
Report Abuse
superpants2020 is not online. superpants2020
Joined: 10 Feb 2013
Total Posts: 804
19 Aug 2016 11:28 PM
B2
Report Abuse
error9999 is not online. 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
superpants2020 is not online. superpants2020
Joined: 10 Feb 2013
Total Posts: 804
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
superpants2020 is not online. superpants2020
Joined: 10 Feb 2013
Total Posts: 804
20 Aug 2016 08:59 AM
DUMP WHOPPS I MEANT BUMP


i like ducks bro. deal wit it.
Report Abuse
superpants2020 is not online. superpants2020
Joined: 10 Feb 2013
Total Posts: 804
20 Aug 2016 09:52 AM
bump.
Report Abuse
LilMcManiac is not online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
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
superpants2020 is not online. superpants2020
Joined: 10 Feb 2013
Total Posts: 804
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
zacharoy56 is not online. zacharoy56
Joined: 18 Oct 2014
Total Posts: 130
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
superpants2020 is not online. superpants2020
Joined: 10 Feb 2013
Total Posts: 804
20 Aug 2016 12:28 PM
I see.


i like ducks bro. deal wit it.
Report Abuse
superpants2020 is not online. superpants2020
Joined: 10 Feb 2013
Total Posts: 804
20 Aug 2016 12:30 PM
Can you explain it further?


i like ducks bro. deal wit it.
Report Abuse
L2000 is not online. 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
superpants2020 is not online. superpants2020
Joined: 10 Feb 2013
Total Posts: 804
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
zacharoy56 is not online. zacharoy56
Joined: 18 Oct 2014
Total Posts: 130
20 Aug 2016 01:03 PM
No problem glad to help
Report Abuse
superpants2020 is not online. superpants2020
Joined: 10 Feb 2013
Total Posts: 804
20 Aug 2016 01:29 PM
Still looking for an answer doe


i like ducks bro. deal wit it.
Report Abuse
superpants2020 is not online. superpants2020
Joined: 10 Feb 2013
Total Posts: 804
20 Aug 2016 04:57 PM
Bump


i like ducks bro. deal wit it.
Report Abuse
superpants2020 is not online. superpants2020
Joined: 10 Feb 2013
Total Posts: 804
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 is not online. 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
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
21 Aug 2016 05:20 PM
you used findfirstchild on k.Value
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image