01 | local Humanoid = script.Parent.Humanoid |
02 | function MoenyGive() |
03 | local tag = Humanoid:findFirstChild( "creator" ) |
04 | if tag ~ = nil then |
05 | if tag.Value ~ = nil then |
06 | local Leaderstats = tag.Value:findFirstChild( "leaderstats" ) |
07 | if Leaderstats ~ = nil then |
08 | Leaderstats.Coins.Value = Leaderstats.Coins.Value + 5 |
09 | wait( 0.1 ) |
10 | print ( "Money gave" ) |
11 | else |
12 | warn() |
13 | script:remove() |
14 | end |
15 | end |
16 | end |
17 | end |
18 | Humanoid.Died:connect(MoenyGive) |
I am not 100% but I believe "Leaderstats" should be with a lowercase, also its better if you use a higher case on connect, such as "Connecet"! I have also re-written your code and added a function to the :Connect.
This most likely won't work but give my attempt a shot.
01 | local Humanoid = script.Parent.Humanoid |
02 |
03 | Humanoid.Died:Connect( function (MoenyGive) |
04 |
05 | function MoenyGive() |
06 | local tag = Humanoid:findFirstChild( "creator" ) |
07 | if tag ~ = nil then |
08 | if tag.Value ~ = nil then |
09 | local Leaderstats = tag.Value:findFirstChild( "leaderstats" ) |
10 | if leaderstats ~ = nil then |
11 | leaderstats.Coins.Value = leaderstats.Coins.Value + 5 |
12 | wait( 0.1 ) |
13 | print ( "Money gave" ) |
14 | else |
15 | warn() |
If this helps shoot me a reply.