Advertisement
SigmaBoy456

Example Resizing Hitbox of sword roblox script

Aug 15th, 2024
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. -- กำหนดตัวแปร player ให้เท่ากับผู้เล่นในเกมที่กำลังเล่นอยู่
  3.  
  4. local character = player.Character
  5. -- กำหนดตัวแปร character ให้เท่ากับตัวละครของผู้เล่นคนนั้น
  6.  
  7. local hasTool = character:FindFirstChildOfClass("Tool")
  8. -- ตรวจหาว่าตัวละครมีเครื่องมือ (Tool) อยู่หรือไม่ และกำหนดให้ตัวแปร hasTool เท่ากับเครื่องมือที่พบ
  9.  
  10. if hasTool and hasTool.Handle then
  11. -- ตรวจสอบว่า hasTool มีค่า (หมายถึงเจอเครื่องมือ) และเครื่องมือมีส่วนที่เรียกว่า Handle หรือไม่
  12.  
  13. hasTool.Handle.Size = Vector3.new(50, 50, 50)
  14. -- ปรับขนาดของ Handle ให้มีขนาด 50x50x50 หน่วย คุณสามารถปรับขนาดเองได้ตามต้องการ
  15.  
  16. hasTool.Transparency = 0.5
  17. -- ปรับความโปร่งใสของเครื่องมือให้เป็น 0.5 (ครึ่งหนึ่งโปร่งแสง) คุณสามารถตั้งค่าเป็น 0 (ทึบแสง) หรืออื่นๆ ระหว่าง 0.1 ถึง 1 ได้
  18.  
  19. hasTool.Handle.Massless = true
  20. -- ทำให้ Handle ของเครื่องมือไม่มีน้ำหนัก (Massless) ซึ่งหมายถึงจะไม่ถูกกระทบด้วยแรงโน้มถ่วง
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement