This maybe can help you making your game
Put it on starterplayerscript
local hideHeightBelow = -0.7
local hideHeightAbove = 9.5
-- Function to set the transparency of the HumanoidRootPart of a character
local function hideHumanoidRootPart(character)
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if humanoidRootPart then
humanoidRootPart.Transparency = 1
end
end
local function checkPlayerHeight()
local player = game.Players.LocalPlayer
local character = player.Character
if character then
for _, otherPlayer in ipairs(game.Players:GetPlayers()) do
if otherPlayer ~= player and otherPlayer.Character then
local otherCharacter = otherPlayer.Character
local otherRootPart = otherCharacter:FindFirstChild("HumanoidRootPart")
if otherRootPart then
local shouldHide = false
local playerPos = player.Character.HumanoidRootPart.Position.Y
local otherPos = otherRootPart.Position.Y
if math.abs(playerPos - otherPos) > 0.1 then
if playerPos < otherPos + hideHeightBelow or playerPos > otherPos + hideHeightAbove then
shouldHide = true
end
end
for _, otherObject in ipairs(otherCharacter:GetDescendants()) do
if otherObject:IsA("BasePart") then
if shouldHide then
otherObject.Transparency = 1
else
otherObject.Transparency = 0
end
end
end
-- Call the hideHumanoidRootPart function to set the transparency of the other player's HumanoidRootPart
if shouldHide then
hideHumanoidRootPart(otherCharacter)
else
otherRootPart.Transparency = 1
end
end
end
end
-- Add the following code to hide the floor when a player is below it
local floor = workspace.Floor
if floor then
for _, obj in ipairs(floor:GetDescendants()) do
if obj:IsA("BasePart") then
if player.Character.HumanoidRootPart.Position.Y < obj.Position.Y then
obj.Transparency = 1
else
obj.Transparency = 0
end
end
end
end
end
end
game:GetService("RunService").RenderStepped:Connect(checkPlayerHeight)```