Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Humanoid = script.Parent.Humanoid --ระบุตัวแปร Humanoid ของModelตัวนี้
- local enemy = script.Parent --ระบุตัวแปรของModelตัวนี้
- function Dead() --สร้างฟังชั่นสำหรับเรียกใช้
- local tag = Humanoid:FindFirstChild("creator") --ค้นหาHumanoidของผู้เล่น(ตัวเรา)
- if tag ~= nil then --ถ้าค่าไม่เท่ากับไม่มีค่า(มีผู้เล่น) หลังจากนั้น
- local leader = tag.Value:FindFirstChild("leaderstats") --ค้นหาValueในleaderstats
- if leader ~= nil then --ถ้าValueค่าไม่เท่ากับไม่มีค่า(เจอValueแล้วนั่นแหละ 555)
- leader.Exp.Value = leader.Exp.Value + 50 --บวกValueของExpขึ้น50
- wait (0.1) --รอ0.1วินาที
- script:Remove() --ลบสคริปนี้ทิ้ง
- enemy:Destroy(wait(5)) --รอ5วินาที แล้วลบModelนี้ทิ้ง
- end
- end
- end
- Humanoid.Died:Connect(Dead) --เรียกใช้ฟังชั่น
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement