Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local LocalPlayer = Players.LocalPlayer
- -- Function to move other players' heads
- local function MovePlayerHead(player)
- local character = player.Character
- if character then
- local head = character:FindFirstChild("Head")
- if head then
- local headCFrame = head.CFrame
- local localHead = LocalPlayer.Character:FindFirstChild("Head")
- if localHead then
- -- Move other player's head in front of local player
- head.CFrame = localHead.CFrame * CFrame.new(0, 0, -3)
- end
- -- Hide other player's body parts except for the head
- for _, part in ipairs(character:GetChildren()) do
- if part.Name ~= "Head" then
- if part:IsA("BasePart") then
- part.Transparency = 1
- end
- end
- end
- end
- end
- end
- -- Function to refresh continuously
- local function RefreshPlayerHeads()
- while true do
- -- Call MovePlayerHead for each player
- for _, player in ipairs(Players:GetPlayers()) do
- if player ~= LocalPlayer then
- MovePlayerHead(player)
- end
- end
- -- Wait for a short time before refreshing again
- wait() -- This will wait for one frame before refreshing again
- end
- end
- -- Connect function to each player
- Players.PlayerAdded:Connect(function(player)
- -- Call the MovePlayerHead function whenever a new player joins
- MovePlayerHead(player)
- end)
- -- Call the MovePlayerHead function for each player already in the game
- for _, player in ipairs(Players:GetPlayers()) do
- if player ~= LocalPlayer then
- MovePlayerHead(player)
- end
- end
- -- Start the RefreshPlayerHeads coroutine
- coroutine.wrap(RefreshPlayerHeads)()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement