Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how do i make a skill but it give stats when kill npc?

my reward script:

local Humanoid = script.Parent.Humanoid
function PwntX_X() 
local tag = Humanoid:findFirstChild("creator") 
	if tag ~= nil then 
		if tag.Value ~= nil then 
local Leaderstats = tag.Value:findFirstChild("leaderstats") 
			if Leaderstats ~= nil then 
Leaderstats.Money.Value = Leaderstats.Money.Value + 3
wait(0.1)
script:remove()
			end 
		end 
	end 
end 
Humanoid.Died:connect(PwntX_X) 

2 answers

The folder leaderstats shouldn't be located in the creator tag, It should be located in the Player

2 comments

0

so you know how to fix it? :( sorry im new

0

and do i need to do anything with skill script?

i tried to fix my skill script, but it not give stats

script.Parent.OnServerEvent:Connect(function(plr)
	local Slash = game.ReplicatedStorage.Slash:Clone()
	Slash.Parent = workspace
	Slash.CanCollide = false
	Slash.Anchored = false
	Slash.CFrame = plr.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-5) * CFrame.fromEulerAnglesXYZ(1.8,0,0)
	Slash.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= plr.Name then
			local Ball = game.ReplicatedStorage.Slash:Clone()
			Ball.Parent = workspace
			Ball.CFrame = Slash.CFrame * CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(math.random(-110,110),math.random(-110,110),math.random(-110,110))
			Ball.CanCollide = false
			Ball.Anchored = true
			Slash:Destroy()
			local creator = Instance.new("ObjectValue")
			local Debris = game:GetService("Debris")
			creator.Name = "creator"
			creator.Value = script.Parent.Parent.Parent
			Debris:AddItem(creator, 2)
			creator.Parent = hit.Parent.Humanoid
			hit.Parent.Humanoid:TakeDamage(5)
			for i = 1,18 do
				wait(.05)
				Ball.Size = Ball.Size + Vector3.new(2,2,2)
				Ball.Transparency = Ball.Transparency + 0.05
			end	
			Ball:Destroy()	
		end
	end)
	local BV = Instance.new("BodyVelocity",Slash)
	BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	BV.Velocity = plr.Character.HumanoidRootPart.CFrame.LookVector * 80
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.