Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why does my tool not change a value within a part after colliding with it?

Asked by 4 years ago
Edited 4 years ago

So basically i have an axe and a tree with a NumberValue that's name is "Health" and when I slash with the axe and the head of the axe collides with the tree its supposed to do 5 dmg but it doesn't even detect the number value

script:

01Properties = {
02    debounce = true, -- Leave this on true.
03    sound_fx = true, -- If you don't want sound to play when tool is activated set this to false.
04    anim_check = true, -- If you don't want animation to play when tool is activated set this to false.
05    ToolDrop = false, -- Set this to true if you want to be able to drop the tool by pressing BackSpace.
06    soundID = 6042531284, -- Sound Id.
07    AnimID = 6461572129, -- Your Animtion id.
08    debounce_lenght = 1, -- how long it will take before you can click again, aka cooldown so you can't spam click the tool.
09    soundDelay = 0.25, -- How long to wait before playing sound
10    enableTrail = true, -- Enable trail thing
11    trail = script.Parent.Head.Trail, -- the trail thing
12    damage = 5 -- how much dmg the thing does
13}
14 
15local Tool = script.Parent
View all 73 lines...
0
LocalScript or ServerScript? OhManXDXD 445 — 4y
0
Also is the name of the NumberValue “NumberValue”? OhManXDXD 445 — 4y
0
Server script and read the description EiOooAxea 70 — 4y

1 answer

Log in to vote
1
Answered by
OhManXDXD 445 Moderation Voter
4 years ago

I think the problem here is, you are looking for a child named “NumberValue” but not a NumberValue itself.

Use FindFirstChildWhichIsA() to find a type of child instead of the name of a child

01Properties = {
02    debounce = true, -- Leave this on true.
03    sound_fx = true, -- If you don't want sound to play when tool is activated set this to false.
04    anim_check = true, -- If you don't want animation to play when tool is activated set this to false.
05    ToolDrop = false, -- Set this to true if you want to be able to drop the tool by pressing BackSpace.
06    soundID = 6042531284, -- Sound Id.
07    AnimID = 6461572129, -- Your Animtion id.
08    debounce_lenght = 1, -- how long it will take before you can click again, aka cooldown so you can't spam click the tool.
09    soundDelay = 0.25, -- How long to wait before playing sound
10    enableTrail = true, -- Enable trail thing
11    trail = script.Parent.Head.Trail, -- the trail thing
12    damage = 5 -- how much dmg the thing does
13}
14 
15local Tool = script.Parent
View all 73 lines...
0
Ty it works now, i just gotta add a de bounce system to it somehow,im not super familiar with how to make a debounce system so any help is appreciated EiOooAxea 70 — 4y
0
It looks like there is already a debounce implemented OhManXDXD 445 — 4y
0
there isnt? EiOooAxea 70 — 4y
0
Properties.debounce OhManXDXD 445 — 4y
View all comments (7 more)
0
wait nvm thats for the animation etc but i need to de bounce the damage etc EiOooAxea 70 — 4y
0
i added a simple debounce but it didnt seem to work for whatever reason EiOooAxea 70 — 4y
0
it does the damage 2 times EiOooAxea 70 — 4y
0
sometimes it does once, sometimes twice and sometimes 3 times EiOooAxea 70 — 4y
0
nvm i fixed the debounce somehow lol EiOooAxea 70 — 4y
0
nvm i fixed the debounce somehow lol EiOooAxea 70 — 4y
Ad

Answer this question