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

How come this script wont work?(Lines 12-15) wont work

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

This is my damage script to my fire ball tool and it works with the damage but when I try to add it so that if the Player kills another person their Exp stat in the leader board raises the damage still works but the Exp stat in leader board doesn't raise. I used the Variable PlayerName to find the name of the Player in the Players Folder so I can access the player


PlayerName = script.Parent.Parent.Parent.Name function onDamage(Part) if Part.Parent:FindFirstChild("Humanoid") ~= nil and Part.Parent.Name ~= "script.Parent.Name" then script.Disabled = true f = Instance.new("Fire", Part) for i = 1,25 do f.Size = f.Size +0.25 Part.Parent.Humanoid.Health = Part.Parent.Humanoid.Health -1 wait(0.05) end Part.Parent.Humanoid.Sit = true if Part.Parent.Humanoid.Health <= 0 then game.Players.PlayerName.leaderstats.Exp = game.Players.PlayerName.leaderstats.Exp +1 end f:remove() script.Parent:remove() end wait(0.025) end script.Parent.Touched:connect(onDamage)
0
Look closely at line 4, what `Part.Parent.Name` is doing. :P TheeDeathCaster 2368 — 9y
0
Try a 'humanoid.Died' connect line. It's in the tips on this website. GoldenPhysics 474 — 9y

3 answers

Log in to vote
1
Answered by
Jonibus 30
9 years ago

Line 4, is the part possibly named script.Parent.Name? If not, remove the quotations and it should work fine. I don't see any other clear errors

0
That is not the problem because that is just for you don't hit yourself. The lines I wanted to add in was 12-14 which gave the Player Exp if they killed a person FALZAR11 0 — 9y
Ad
Log in to vote
1
Answered by 9 years ago
game.Players.LocalPlayer.leaderstats.Exp = game.Players.LocalPlayer.leaderstats.Exp +1
Log in to vote
0
Answered by 9 years ago

On line 5, you disable the script. That's why nothing happens.

0
No the disable is to stop spamming even with the line the script works its only line 12-15 FALZAR11 0 — 9y

Answer this question