Advertisement
Anukun_Lucifer

KillExpScript

Jul 6th, 2023
2,480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.23 KB | Source Code | 0 0
  1. local Humanoid = script.Parent.Humanoid   --ระบุตัวแปร Humanoid ของModelตัวนี้
  2. local enemy =  script.Parent   --ระบุตัวแปรของModelตัวนี้
  3.  
  4. function Dead()  --สร้างฟังชั่นสำหรับเรียกใช้
  5.     local tag = Humanoid:FindFirstChild("creator")   --ค้นหาHumanoidของผู้เล่น(ตัวเรา)
  6.     if tag ~= nil then  --ถ้าค่าไม่เท่ากับไม่มีค่า(มีผู้เล่น)  หลังจากนั้น
  7.         local leader = tag.Value:FindFirstChild("leaderstats")  --ค้นหาValueในleaderstats
  8.         if leader ~= nil then  --ถ้าValueค่าไม่เท่ากับไม่มีค่า(เจอValueแล้วนั่นแหละ 555)
  9.             leader.Exp.Value = leader.Exp.Value + 50  --บวกValueของExpขึ้น50
  10.             wait (0.1)  --รอ0.1วินาที
  11.             script:Remove()  --ลบสคริปนี้ทิ้ง
  12.             enemy:Destroy(wait(5))  --รอ5วินาที แล้วลบModelนี้ทิ้ง
  13.         end
  14.     end
  15. end
  16. Humanoid.Died:Connect(Dead)  --เรียกใช้ฟังชั่น
Tags: Roblox RPG exp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement