Floor or roof for your isometric game/ top down game

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)```
26 Likes

Nice work! This looks very helpful for these types of games!

Also, as @Moleza has said, this fits better in #resources:community-resources than #development-discussion.

1 Like

genuine lifesaver. My game has the option to change camera modes for player preference and this is actually really helpful for this case.
Great script 10/10

1 Like

It would be nicer if it was transparent and faded in/out, but yes, this is a great asset for an isometric game!

1 Like

it’s not working, am i doing this wrong? script and localscript does not do anything when i pasted the code. (before you tell me i need to put it on starterplayerscripts, i did that)

you need to change “local floor = workspace.Floor” the floor to the name of your model/parts