hi i have problem with 2 exp everything work but i have problem with reward from npc they kill that npc script reward
local Enemy = script.Parent.Humanoid
function KillForXp()
local nume = 100
local tag = Enemy:findFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
local Data = tag.Value:findFirstChild("Data")
local leader = tag.Value:FindFirstChild("Quest")
if leader.Num.Value == script.Parent.Data.Num.Value then
if leader ~= nil then
leader.Kills.Value = leader.Kills.Value + 1
end
end
if Data ~= nil then
if Data.Expx2.Value < 0 then
Data.Exp.Value += nume
elseif Data.Expx2.Value > 0 then
Data.Exp.Vaule += (nume * 2)
wait(0.01)
script:Destroy()
end
end
end
end
Enemy.Died:connect(KillForXp)
end
Apart from the issues and recommendations by @Valkyrop, please format your document correctly. It is currently very hard to read. If you are unsure how to properly format it, press the button “format document” in the scripting view.
local Enemy = script.Parent.Humanoid
function KillForXp()
local tag = Enemy:findFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
local Data = tag.Value:findFirstChild("Data")
local leader = tag.Value:FindFirstChild("Quest")
if leader.Num.Value == script.Parent.Data.Num.Value then
if leader ~= nil then
leader.Kills.Value = leader.Kills.Value + 1
end
end
if Data ~= nil then
Data.Beli.Value = Data.Beli.Value + 100
Data.Exp.Value = Data.Exp.Value + 100
wait(0.01)
script:Destroy()
end
end
end
end
Enemy.Died:connect(KillForXp)