2D Raycast Renderer in Lua Sandbox Place 1 (Roblox

Run Settings
LanguageLua
Language Version
Run Command
--[[ Sounds: "Hurt" - "rbxassetid://6314900933" "Slam" - "rbxassetid://3908308607" ]] Folder0 = Instance.new("Folder") Part1 = Instance.new("Part") Part2 = Instance.new("Part") Part3 = Instance.new("Part") Part4 = Instance.new("Part") Part5 = Instance.new("Part") Part6 = Instance.new("Part") Part7 = Instance.new("Part") WedgePart8 = Instance.new("WedgePart") Part9 = Instance.new("Part") Part10 = Instance.new("Part") Part11 = Instance.new("Part") Part12 = Instance.new("Part") Part13 = Instance.new("Part") Part14 = Instance.new("Part") Part15 = Instance.new("Part") Part16 = Instance.new("Part") Part17 = Instance.new("Part") Decal18 = Instance.new("Decal") Folder0.Name = "Map" Folder0.Parent = owner.Character Part1.Name = "BlueWall" Part1.Parent = Folder0 Part1.CFrame = CFrame.new(-47.5, 0.5, -21.5, 0, 0, 1, 0, 1, -0, -1, 0, 0) Part1.Orientation = Vector3.new(0, 90, 0) Part1.Position = Vector3.new(-47.5, 0.5, -21.5) Part1.Rotation = Vector3.new(0, 90, 0) Part1.Color = Color3.new(0.0156863, 0.686275, 0.92549) Part1.Size = Vector3.new(8, 1, 4) Part1.Anchored = true Part1.BottomSurface = Enum.SurfaceType.Smooth Part1.BrickColor = BrickColor.new("Cyan") Part1.TopSurface = Enum.SurfaceType.Smooth Part1.brickColor = BrickColor.new("Cyan") Part2.Name = "Cylinder" Part2.Parent = Folder0 Part2.CFrame = CFrame.new(-25.5, 0.5, -2.5, 0, 0, -1, -1, 0, 0, 0, 1, 0) Part2.Orientation = Vector3.new(0, -90, -90) Part2.Position = Vector3.new(-25.5, 0.5, -2.5) Part2.Rotation = Vector3.new(90, -90, 0) Part2.Size = Vector3.new(1, 1, 1) Part2.Anchored = true Part2.BottomSurface = Enum.SurfaceType.Smooth Part2.TopSurface = Enum.SurfaceType.Smooth Part2.Shape = Enum.PartType.Cylinder Part3.Name = "Cylinder" Part3.Parent = Folder0 Part3.CFrame = CFrame.new(-45.4000015, 0.5, -8.60000038, 0, 0, -1, -1, 0, 0, 0, 1, 0) Part3.Orientation = Vector3.new(0, -90, -90) Part3.Position = Vector3.new(-45.400001525878906, 0.5, -8.600000381469727) Part3.Rotation = Vector3.new(90, -90, 0) Part3.Color = Color3.new(1, 0.34902, 0.34902) Part3.Size = Vector3.new(1, 0.7999999523162842, 0.7999999523162842) Part3.Anchored = true Part3.BottomSurface = Enum.SurfaceType.Smooth Part3.BrickColor = BrickColor.new("Persimmon") Part3.TopSurface = Enum.SurfaceType.Smooth Part3.brickColor = BrickColor.new("Persimmon") Part3.Shape = Enum.PartType.Cylinder Part4.Name = "RedWall" Part4.Parent = Folder0 Part4.CFrame = CFrame.new(-33, 0.5, -15.5, 1, 0, 0, 0, 1, 0, 0, 0, 1) Part4.Position = Vector3.new(-33, 0.5, -15.5) Part4.Color = Color3.new(1, 0, 0) Part4.Size = Vector3.new(8, 1, 1) Part4.Anchored = true Part4.BottomSurface = Enum.SurfaceType.Smooth Part4.BrickColor = BrickColor.new("Really red") Part4.TopSurface = Enum.SurfaceType.Smooth Part4.brickColor = BrickColor.new("Really red") Part5.Parent = Folder0 Part5.CFrame = CFrame.new(-42.5, 0.25, -10.8999996, 1, 0, 0, 0, 1, 0, 0, 0, 1) Part5.Position = Vector3.new(-42.5, 0.25, -10.899999618530273) Part5.Size = Vector3.new(3, 0.5, 0.19999998807907104) Part5.Anchored = true Part5.BottomSurface = Enum.SurfaceType.Smooth Part5.TopSurface = Enum.SurfaceType.Smooth Part6.Parent = Folder0 Part6.CFrame = CFrame.new(-25.8500004, 0.5, -8, 0, 0, 1, 0, 1, -0, -1, 0, 0) Part6.Orientation = Vector3.new(0, 90, 0) Part6.Position = Vector3.new(-25.850000381469727, 0.5, -8) Part6.Rotation = Vector3.new(0, 90, 0) Part6.Color = Color3.new(0.972549, 0.972549, 0.972549) Part6.Size = Vector3.new(8, 1, 0.30000001192092896) Part6.Anchored = true Part6.BottomSurface = Enum.SurfaceType.Smooth Part6.BrickColor = BrickColor.new("Institutional white") Part6.TopSurface = Enum.SurfaceType.Smooth Part6.brickColor = BrickColor.new("Institutional white") Part7.Parent = Folder0 Part7.CFrame = CFrame.new(-24.6499996, 0.5, -8, 0, 0, 1, 0, 1, -0, -1, 0, 0) Part7.Orientation = Vector3.new(0, 90, 0) Part7.Position = Vector3.new(-24.649999618530273, 0.5, -8) Part7.Rotation = Vector3.new(0, 90, 0) Part7.Color = Color3.new(0.972549, 0.972549, 0.972549) Part7.Size = Vector3.new(8, 1, 0.30000001192092896) Part7.Anchored = true Part7.BottomSurface = Enum.SurfaceType.Smooth Part7.BrickColor = BrickColor.new("Institutional white") Part7.TopSurface = Enum.SurfaceType.Smooth Part7.brickColor = BrickColor.new("Institutional white") WedgePart8.Parent = Folder0 WedgePart8.CFrame = CFrame.new(-50, 0.5, -7.5, 0, 0, -1, 1, 0, 0, 0, -1, 0) WedgePart8.Orientation = Vector3.new(0, -90, 90) WedgePart8.Position = Vector3.new(-50, 0.5, -7.5) WedgePart8.Rotation = Vector3.new(-90, -90, 0) WedgePart8.Size = Vector3.new(1, 1, 2) WedgePart8.Anchored = true WedgePart8.BottomSurface = Enum.SurfaceType.Smooth Part9.Parent = Folder0 Part9.CFrame = CFrame.new(-71, 0.5, -17.5, -1, 0, 0, 0, 1, 0, 0, 0, -1) Part9.Orientation = Vector3.new(0, 180, 0) Part9.Position = Vector3.new(-71, 0.5, -17.5) Part9.Rotation = Vector3.new(180, 0, 180) Part9.Color = Color3.new(0.239216, 0.239216, 0.239216) Part9.Size = Vector3.new(1, 1, 58) Part9.Anchored = true Part9.BottomSurface = Enum.SurfaceType.Smooth Part9.BrickColor = BrickColor.new("Medium brown") Part9.TopSurface = Enum.SurfaceType.Smooth Part9.brickColor = BrickColor.new("Medium brown") Part10.Parent = Folder0 Part10.CFrame = CFrame.new(-46, 0.5, 7.5, 0, 0, 1, 0, 1, -0, -1, 0, 0) Part10.Orientation = Vector3.new(0, 90, 0) Part10.Position = Vector3.new(-46, 0.5, 7.5) Part10.Rotation = Vector3.new(0, 90, 0) Part10.Color = Color3.new(0.2, 0.188235, 0.176471) Part10.Size = Vector3.new(1, 1, 58) Part10.Anchored = true Part10.BottomSurface = Enum.SurfaceType.Smooth Part10.BrickColor = BrickColor.new("Earth green") Part10.TopSurface = Enum.SurfaceType.Smooth Part10.brickColor = BrickColor.new("Earth green") Part11.Name = "YellowWall" Part11.Parent = Folder0 Part11.CFrame = CFrame.new(-38, 0.5, -25, 0, 0, 1, 0, 1, -0, -1, 0, 0) Part11.Orientation = Vector3.new(0, 90, 0) Part11.Position = Vector3.new(-38, 0.5, -25) Part11.Rotation = Vector3.new(0, 90, 0) Part11.Color = Color3.new(1, 1, 0) Part11.Size = Vector3.new(4, 1, 4) Part11.Anchored = true Part11.BottomSurface = Enum.SurfaceType.Smooth Part11.BrickColor = BrickColor.new("New Yeller") Part11.TopSurface = Enum.SurfaceType.Smooth Part11.brickColor = BrickColor.new("New Yeller") Part12.Parent = Folder0 Part12.CFrame = CFrame.new(-52.8000031, 0.5, -12.5, 0, 0, 1, 0, 1, -0, -1, 0, 0) Part12.Orientation = Vector3.new(0, 90, 0) Part12.Position = Vector3.new(-52.80000305175781, 0.5, -12.5) Part12.Rotation = Vector3.new(0, 90, 0) Part12.Color = Color3.new(0.972549, 0.972549, 0.972549) Part12.Size = Vector3.new(4, 1, 4) Part12.Anchored = true Part12.BottomSurface = Enum.SurfaceType.Smooth Part12.BrickColor = BrickColor.new("Institutional white") Part12.TopSurface = Enum.SurfaceType.Smooth Part12.brickColor = BrickColor.new("Institutional white") Part13.Parent = Folder0 Part13.CFrame = CFrame.new(-46, 0.5, -42.5, 0, 0, 1, 0, 1, -0, -1, 0, 0) Part13.Orientation = Vector3.new(0, 90, 0) Part13.Position = Vector3.new(-46, 0.5, -42.5) Part13.Rotation = Vector3.new(0, 90, 0) Part13.Color = Color3.new(0.239216, 0.239216, 0.239216) Part13.Size = Vector3.new(1, 1, 58) Part13.Anchored = true Part13.BottomSurface = Enum.SurfaceType.Smooth Part13.BrickColor = BrickColor.new("Medium brown") Part13.TopSurface = Enum.SurfaceType.Smooth Part13.brickColor = BrickColor.new("Medium brown") Part14.Parent = Folder0 Part14.CFrame = CFrame.new(-30.5, 0.5, -0.5, 0, 0, 1, 0, 1, -0, -1, 0, 0) Part14.Orientation = Vector3.new(0, 90, 0) Part14.Position = Vector3.new(-30.5, 0.5, -0.5) Part14.Rotation = Vector3.new(0, 90, 0) Part14.Color = Color3.new(0.972549, 0.972549, 0.972549) Part14.Size = Vector3.new(1, 1, 1) Part14.Anchored = true Part14.BottomSurface = Enum.SurfaceType.Smooth Part14.BrickColor = BrickColor.new("Institutional white") Part14.TopSurface = Enum.SurfaceType.Smooth Part14.brickColor = BrickColor.new("Institutional white") Part15.Parent = Folder0 Part15.CFrame = CFrame.new(-21, 0.5, -17.5, -1, 0, 0, 0, 1, 0, 0, 0, -1) Part15.Orientation = Vector3.new(0, 180, 0) Part15.Position = Vector3.new(-21, 0.5, -17.5) Part15.Rotation = Vector3.new(180, 0, 180) Part15.Color = Color3.new(0.239216, 0.239216, 0.239216) Part15.Size = Vector3.new(1, 1, 58) Part15.Anchored = true Part15.BottomSurface = Enum.SurfaceType.Smooth Part15.BrickColor = BrickColor.new("Medium brown") Part15.TopSurface = Enum.SurfaceType.Smooth Part15.brickColor = BrickColor.new("Medium brown") Part16.Parent = Folder0 Part16.CFrame = CFrame.new(-42.5, 0.75, -10.8999996, 1, 0, 0, 0, 1, 0, 0, 0, 1) Part16.Position = Vector3.new(-42.5, 0.75, -10.899999618530273) Part16.Color = Color3.new(0.596078, 0.760784, 0.858824) Part16.Size = Vector3.new(3, 0.5, 0.19999998807907104) Part16.Anchored = true Part16.BottomSurface = Enum.SurfaceType.Smooth Part16.BrickColor = BrickColor.new("Baby blue") Part16.TopSurface = Enum.SurfaceType.Smooth Part16.brickColor = BrickColor.new("Baby blue") Part17.Parent = owner.Character Part17.CFrame = CFrame.new(-37, 0.5, -5.80000305, 1, 0, 0, 0, 1, 0, 0, 0, 1) Part17.Position = Vector3.new(-37, 0.5, -5.8000030517578125) Part17.Color = Color3.new(0,1,0) Part17.Size = Vector3.new(1,1,1) Part17.Anchored = true Part17.BottomSurface = Enum.SurfaceType.Smooth Part17.BrickColor = BrickColor.new("Lime green") Part17.TopSurface = Enum.SurfaceType.Smooth Part17.brickColor = BrickColor.new("Lime green") Part17.Name = "PlayerCameraPart" Decal18.Parent = Part17 Decal18.Name = "Face" Decal18.Texture = "http://www.roblox.com/asset/?id=13449209" for i, v in pairs(Folder0:GetDescendants()) do if v:IsA("BasePart") then local texture = Instance.new("ImageLabel") texture.Image = "rbxassetid://10043212933" texture.Name = "Texture" texture.Parent = v end end --local CameraCFrame = Instance.new("CFrameValue",owner.Character) --CameraCFrame.Name = "CameraCFrame" --CameraCFrame.Value = Part16.CFrame --ClickDetector18.Parent = Folder0 --ClickDetector18.MouseClick:Connect(function(plr) -- NLS([[ -- local controller -- local cameracframe -- for i, v in pairs(workspace:GetChildren()) do -- if v:IsA("Model") then -- if v:FindFirstChild("PlayerCameraPart") then -- controller = v.PlayerCameraPart -- cameracframe = v.CameraCFrame.Value -- end -- end -- end -- game:GetService("RunService").RenderStepped:Connect(function() -- if controller and cameracframe then -- cameracframe = controller.Parent.CameraCFrame.Value -- controller.CFrame = cameracframe -- end -- end) -- ]],plr.Character) --end) --for i, v in pairs(Folder0:GetChildren()) do -- if v:IsA("BasePart") then -- v.CanCollide = false -- end --end local Part19 = Part17:Clone() Part19.Parent = Part17.Parent Part19.Name = "ServerPart" Part17.CanCollide = false Part17.CanTouch = false Part17.CanQuery = false Part17.Transparency = 1 Part17:FindFirstChildOfClass("Decal").Transparency = 1 Instance.new("RemoteEvent",owner.Character).OnServerEvent:Connect(function(_,cframe) --CameraCFrame.Value = cframe Part19.CFrame = cframe end) NLS([[ task.spawn(function() repeat workspace.CurrentCamera.CameraType = "Scriptable" task.wait() until workspace.CurrentCamera.CameraType == "Scriptable" end) ScreenGui0 = Instance.new("ScreenGui") Frame1 = Instance.new("Frame") Frame2 = Instance.new("Frame") Frame3 = Instance.new("Frame") Frame4 = Instance.new("Frame") Frame5 = Instance.new("Frame") Frame6 = Instance.new("Frame") TextLabel7 = Instance.new("TextLabel") ScreenGui0.Name = "RendererGui" ScreenGui0.Parent = owner.PlayerGui ScreenGui0.Enabled = false ScreenGui0.IgnoreGuiInset = true ScreenGui0.ZIndexBehavior = Enum.ZIndexBehavior.Sibling Frame1.Name = "MainFrame" Frame1.Parent = ScreenGui0 Frame1.Size = UDim2.new(1, 0, 1, 0) Frame1.BackgroundColor = BrickColor.new("Really black") Frame1.BackgroundColor3 = Color3.new(0, 0, 0) Frame1.BorderSizePixel = 0 Frame2.Name = "Background" Frame2.Parent = Frame1 Frame2.Position = UDim2.new(0.5, 0, 0.5, 0) Frame2.Size = UDim2.new(1, 0, 1, 0) Frame2.AnchorPoint = Vector2.new(0.5, 0.5) Frame2.BackgroundColor = BrickColor.new("Institutional white") Frame2.BackgroundColor3 = Color3.new(1, 1, 1) Frame2.BackgroundTransparency = 1 Frame2.BorderSizePixel = 0 Frame2.ClipsDescendants = true Frame2.SizeConstraint = Enum.SizeConstraint.RelativeYY Frame3.Name = "Floor" Frame3.Parent = Frame2 Frame3.Position = UDim2.new(0, 0, 0.5, 0) Frame3.Size = UDim2.new(1, 0, 0.5, 0) Frame3.BackgroundColor = BrickColor.new("Reddish brown") Frame3.BackgroundColor3 = Color3.new(0.403922, 0.258824, 0.0901961) Frame3.BorderSizePixel = 0 Frame4.Name = "Ceiling" Frame4.Parent = Frame2 Frame4.Size = UDim2.new(1, 0, 0.5, 0) Frame4.BackgroundColor = BrickColor.new("Dark taupe") Frame4.BackgroundColor3 = Color3.new(0.298039, 0.298039, 0.298039) Frame4.BorderSizePixel = 0 Frame5.Name = "Canvas" Frame5.Parent = Frame1 Frame5.Position = UDim2.new(0.5, 0, 0.5, 0) Frame5.Size = UDim2.new(1, 0, 1, 0) Frame5.AnchorPoint = Vector2.new(0.5, 0.5) Frame5.BackgroundColor = BrickColor.new("Institutional white") Frame5.BackgroundColor3 = Color3.new(1, 1, 1) Frame5.BackgroundTransparency = 1 Frame5.BorderSizePixel = 0 Frame5.ClipsDescendants = true Frame5.SizeConstraint = Enum.SizeConstraint.RelativeYY Frame5.ZIndex = 2 Frame6.Name = "Disclaimer" Frame6.Parent = ScreenGui0 Frame6.Size = UDim2.new(1,0,1,0) Frame6.BackgroundColor3 = Color3.fromRGB(50,50,50) Frame6.BorderSizePixel = 0 Frame6.ZIndex = 999 TextLabel7.Name = "DisclaimerTxt" TextLabel7.Size = UDim2.fromScale(1,.5) TextLabel7.AnchorPoint = Vector2.new(.5,.5) TextLabel7.Position = UDim2.fromScale(.5,.5) TextLabel7.BackgroundTransparency = 1 TextLabel7.FontFace = Font.fromName("GothamBlack",Enum.FontWeight.Bold,Enum.FontStyle.Normal) TextLabel7.Text = "This project is recreating the original DOOM. It is nowhere near 1:1, it's more 0.1:1. Base raycaster made by Ethanthegrand14. Copyright info: DOOM®© 1993-2023 id Software LLC, a ZeniMax Media company. DOOM, id, id Software, id Tech and related logos are registered trademarks or trademarks of the id Software LLC in the U.S. and/or other countries. Bethesda, Bethesda Softworks, ZeniMax and related logos are registered trademarks or trademarks of ZeniMax Media Inc. in the U.S. and/or other countries. Nerve is a trademark of Nerve Software LLC. All Rights Reserved." TextLabel7.TextColor3 = Color3.fromRGB(150,150,150) TextLabel7.TextScaled = true TextLabel7.Parent = Frame6 local Gui = ScreenGui0 local UIS = game:GetService("UserInputService") local RS = game:GetService("RunService") local Players = game:GetService("Players") local LocalPlayer = Players.LocalPlayer repeat task.wait() until LocalPlayer.Character local Character = LocalPlayer.Character local Humanoid = Character:WaitForChild("Humanoid") -- Camera CameraPart = owner.Character:WaitForChild("PlayerCameraPart") -- The player's camera FieldOfView = 50 RenderDistance = 100 -- How far the game will render your world CameraHeight = 0.5 -- Shifts the camera up the Y axis (0-1) -- Picture Resolution = 70 -- The amount of columns and rays that will be used ObjectHeightMultiplier = 1 -- Extra height for walls and sprites -- Graphics ShadingLevel = 2 -- Setting this below 1 will brighten certain faces. And setting above 1 will darken certain faces. 1 is no shading -- Player DisableRobloxAvatarMovement = true -- Disabled movement from user's roblox characters PlayerCollisionsEnabled = true -- Enabled collision for the CameraPart PlayerWalkSpeed = 5 PlayerTurnSpeed = 3 local LevelWorkspace = owner.Character.Map local PlayerWalkSpeedPerSecond = PlayerWalkSpeed local PlayerTurnSpeedPerSecond = PlayerTurnSpeed local DisablePlayerMovement = true local PlayerCollisionsEnabled = true local KeysBeingPressed = { Up = false, Left = false, Down = false, Right = false, } --if CameraPart.Parent:FindFirstChild("ServerPart") then -- CameraPart.Parent.ServerPart.Transparency = 1 --end -- Collision local function CheckForWall(RayLength) local Params = RaycastParams.new() Params.FilterType = Enum.RaycastFilterType.Include Params.FilterDescendantsInstances = LevelWorkspace:GetChildren() local ViewRayOrigin = CameraPart.Position local ViewRayDirection = CameraPart.CFrame.LookVector * RayLength local ViewRay = workspace:Raycast(ViewRayOrigin, ViewRayDirection, Params) if ViewRay and ViewRay.Instance and ViewRay.Instance:IsA("BasePart") and ViewRay.Instance.CanCollide and PlayerCollisionsEnabled then local HitPart = ViewRay.Instance return true else return false end end -- Movement local function WalkForwards(deltaTime) local deltaSpeed = deltaTime * PlayerWalkSpeedPerSecond if not CheckForWall(1) then CameraPart.CFrame = CameraPart.CFrame * CFrame.new(0, 0, -deltaSpeed) owner.Character.RemoteEvent:FireServer(CameraPart.CFrame) end end local function TurnLeft(deltaTime) local deltaSpeed = deltaTime * PlayerTurnSpeedPerSecond CameraPart.CFrame = CameraPart.CFrame * CFrame.Angles(0, deltaSpeed, 0) owner.Character.RemoteEvent:FireServer(CameraPart.CFrame) end local function WalkBackwards(deltaTime) local deltaSpeed = deltaTime * PlayerWalkSpeedPerSecond if not CheckForWall(-1) then CameraPart.CFrame = CameraPart.CFrame * CFrame.new(0, 0, deltaSpeed) owner.Character.RemoteEvent:FireServer(CameraPart.CFrame) end end local function TurnRight(deltaTime) local deltaSpeed = deltaTime * PlayerTurnSpeedPerSecond CameraPart.CFrame = CameraPart.CFrame * CFrame.Angles(0, -deltaSpeed, 0) owner.Character.RemoteEvent:FireServer(CameraPart.CFrame) end -- Get inputs UIS.InputBegan:Connect(function(Input, GPE) if GPE then return end if Input.KeyCode == Enum.KeyCode.W or Input.KeyCode == Enum.KeyCode.Up or Input.KeyCode == Enum.KeyCode.DPadUp then KeysBeingPressed[1] = true end if Input.KeyCode == Enum.KeyCode.A or Input.KeyCode == Enum.KeyCode.Left or Input.KeyCode == Enum.KeyCode.DPadLeft then KeysBeingPressed[2] = true end if Input.KeyCode == Enum.KeyCode.S or Input.KeyCode == Enum.KeyCode.Down or Input.KeyCode == Enum.KeyCode.DPadDown then KeysBeingPressed[3] = true end if Input.KeyCode == Enum.KeyCode.D or Input.KeyCode == Enum.KeyCode.Right or Input.KeyCode == Enum.KeyCode.DPadRight then KeysBeingPressed[4] = true end if Input.KeyCode == Enum.KeyCode.Comma then if Frame6 then Frame6:Destroy() end end end) UIS.InputEnded:Connect(function(Input, GPE) if Input.KeyCode == Enum.KeyCode.W or Input.KeyCode == Enum.KeyCode.Up or Input.KeyCode == Enum.KeyCode.DPadUp then KeysBeingPressed[1] = false end if Input.KeyCode == Enum.KeyCode.A or Input.KeyCode == Enum.KeyCode.Left or Input.KeyCode == Enum.KeyCode.DPadLeft then KeysBeingPressed[2] = false end if Input.KeyCode == Enum.KeyCode.S or Input.KeyCode == Enum.KeyCode.Down or Input.KeyCode == Enum.KeyCode.DPadDown then KeysBeingPressed[3] = false end if Input.KeyCode == Enum.KeyCode.D or Input.KeyCode == Enum.KeyCode.Right or Input.KeyCode == Enum.KeyCode.DPadRight then KeysBeingPressed[4] = false end end) -- Disabled roblox player movement if DisablePlayerMovement then Humanoid.JumpPower = 0 Humanoid.WalkSpeed = 0 end -- Main loop local function onRenderStep(deltaTime) -- deltaTime so that the player's walkspeed isn't affected from their FPS if KeysBeingPressed[1] then -- Walk forwards WalkForwards(deltaTime) end if KeysBeingPressed[2] then -- Turn left TurnLeft(deltaTime) end if KeysBeingPressed[3] then -- Walk backwards WalkBackwards(deltaTime) end if KeysBeingPressed[4] then -- Turn right TurnRight(deltaTime) end end RS.RenderStepped:Connect(onRenderStep) local Canvas = Frame1:WaitForChild("Canvas") local RS = game:GetService("RunService") local CameraPart = CameraPart local FrameSizeX = (1 / Resolution) local SpritesTable = {} local function GenerateFrames() -- Generate columns for i = 1, Resolution do local FramePosX = 1 / Resolution * (i - 1) -- Main column local Frame = Instance.new("Frame") Frame.ClipsDescendants = true Frame.LayoutOrder = i Frame.Name = "Frame" .. i Frame.BorderSizePixel = 0 Frame.AnchorPoint = Vector2.new(0, CameraHeight) Frame.Size = UDim2.fromScale(FrameSizeX, 0) Frame.Position = UDim2.fromScale(FramePosX, 0.5) --local ImageLabel = Instance.new("ImageLabel") --ImageLabel.Size = UDim2.fromScale(1,1) --ImageLabel.LayoutOrder = i --ImageLabel.Name = "ImageFrame" --ImageLabel.BorderSizePixel = 0 Frame.Parent = Canvas --ImageLabel.Parent = Frame end end local function ClearCanvas() -- Clears any old frames Canvas:ClearAllChildren() end function NormalToFace(normalVector, part) local function GetNormalFromFace(part, normalId) return part.CFrame:VectorToWorldSpace(Vector3.FromNormalId(normalId)) end local TOLERANCE_VALUE = 1 - 0.001 local allFaceNormalIds = { Enum.NormalId.Front, Enum.NormalId.Back, Enum.NormalId.Bottom, Enum.NormalId.Top, Enum.NormalId.Left, Enum.NormalId.Right } for _, normalId in pairs(allFaceNormalIds) do -- If the two vectors are almost parallel, if GetNormalFromFace(part, normalId):Dot(normalVector) > TOLERANCE_VALUE then return normalId -- We found it! end end return nil -- None found within tolerance. end local function UpdateFrames() -- Render the picture local Count = -Resolution / 2 -- Frames for i, Frame in ipairs(Canvas:GetChildren()) do if Frame:IsA("Frame") then local Params = RaycastParams.new() Params.FilterType = Enum.RaycastFilterType.Include Params.FilterDescendantsInstances = LevelWorkspace:GetChildren() local ViewRayOrigin = CameraPart.Position local RayAngle = CFrame.Angles(0, -math.rad((Count * FieldOfView) / Resolution), 0) local ViewRayDirection = (CameraPart.CFrame * RayAngle).LookVector * RenderDistance local ViewRay = workspace:Raycast(ViewRayOrigin, ViewRayDirection, Params) if ViewRay and ViewRay.Instance and ViewRay.Instance:IsA("BasePart") and ViewRay.Instance.Transparency < 1 then local HitPart = ViewRay.Instance --print(ViewRay.Instance) --print(ViewRay.Position) --if HitPart:FindFirstChild("Texture") and HitPart.Texture:IsA("ImageLabel") and TexturesEnabled then -- if Frame.ImageFrame.Image ~= HitPart.Texture.Image then -- -- Implement image for texturing -- Frame.ImageFrame.Image = HitPart.Texture.Image -- end --elseif TexturesEnabled then -- Frame.ImageFrame.Image = "" --end -- divide by cos(angle of ray - viewAngle) and use that as the distance local RayAngleX, RayAngleY, RayAngleZ = RayAngle:ToEulerAnglesXYZ() -- RayAngle is a CFrame value local Distance = ((ViewRayOrigin - ViewRay.Position).Magnitude) * math.cos(RayAngleY) Frame.Size = UDim2.fromScale(FrameSizeX, (1 / Distance) * ObjectHeightMultiplier) -- Shading local Face = NormalToFace(ViewRay.Normal, HitPart) if Face == Enum.NormalId.Right or Face == Enum.NormalId.Left then Frame.BackgroundColor3 = Color3.new(HitPart.Color.R / ShadingLevel, HitPart.Color.G / ShadingLevel, HitPart.Color.B / ShadingLevel) else Frame.BackgroundColor3 = HitPart.Color end -- Debug --local DebugLaser = Instance.new("Part") -- Visualise the rays --DebugLaser.Anchored = true --DebugLaser.Name = "DebugLaser" --DebugLaser.Size = Vector3.new(0.2, 0.2, Distance) --DebugLaser.CFrame = CFrame.new(ViewRayOrigin, ViewRay.Position) * CFrame.new(0, 0, -Distance/2) --DebugLaser.Parent = workspace else Frame.BackgroundTransparency = 1 end Count = Count + 1 end end end ClearCanvas() -- Just incase. GenerateFrames() -- Generate all the columns that will be used. UpdateFrames() ScreenGui0.Enabled = true RS.RenderStepped:Connect(function() -- Always render the picture UpdateFrames() end) local Sound = Instance.new("Sound") Sound.SoundId = "rbxassetid://3908308607" Sound.PlayOnRemove = true Sound.Parent = Frame6 Sound:Play() task.wait(7.5) if Frame6 then Frame6:Destroy() end -- Made by LikeableEmmec and man who would like to be stricken from the record (not Ethanthegrand14) (fr tho ethanthegrand truly is very grand) ]],owner.Character)
Editor Settings
Theme
Key bindings
Full width
Lines