Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoid = character:WaitForChild("Humanoid")
- local camera = workspace.CurrentCamera
- local mouse = player:GetMouse()
- local parts = {"RightUpperArm", "RightLowerArm", "RightHand", "LeftUpperArm", "LeftLowerArm", "LeftHand",
- "RightUpperLeg", "RightLowerLeg", "RightFoot", "LeftUpperLeg", "LeftLowerLeg", "LeftFoot",
- "UpperTorso", "LowerTorso"}
- -- เปลี่ยนรูปเคอร์เซอร์
- local function changeCursorIcon()
- mouse.Icon = "rbxassetid://5054846840" -- Asset ID ของเคอร์เซอร์
- end
- -- อัปเดตตัวละครและจัดการความโปร่งใส
- local function updateCharacter(newCharacter)
- character = newCharacter or player.Character
- humanoid = character:WaitForChild("Humanoid")
- local cachedParts = {} -- เก็บชิ้นส่วนของตัวละคร
- -- วนลูปเก็บชิ้นส่วนที่พบใน character
- for _, partName in ipairs(parts) do
- local part = character:FindFirstChild(partName)
- if part then table.insert(cachedParts, part) end
- end
- -- อัปเดตค่าความโปร่งใสของชิ้นส่วนในทุกเฟรม
- game:GetService("RunService").RenderStepped:Connect(function()
- for _, part in ipairs(cachedParts) do
- part.LocalTransparencyModifier = 0 -- ตั้งค่าความโปร่งใส
- end
- humanoid.CameraOffset = Vector3.new(0, 0, -1) -- ปรับมุมมองกล้อง
- end)
- end
- -- ล็อคมุมกล้องเป็น FirstPerson
- local function lockFirstPerson()
- player.CameraMode = Enum.CameraMode.LockFirstPerson
- camera.CameraSubject = humanoid -- ติดตาม humanoid
- end
- -- การตั้งค่าเริ่มต้นเมื่อเกมเริ่ม
- local function initializeGame()
- updateCharacter(character)
- lockFirstPerson()
- changeCursorIcon()
- end
- -- เรียกใช้งานเมื่อเริ่มเกม
- initializeGame()
- -- อัปเดตตัวละครเมื่อเกิดใหม่
- player.CharacterAdded:Connect(function(newCharacter)
- updateCharacter(newCharacter)
- lockFirstPerson()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement