2D Raycaster (Solo)

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([[ local camera = workspace.CurrentCamera local camerapart = owner.Character.PlayerCameraPart repeat camera.CameraType = "Scriptable" task.wait() until camera.CameraType == "Scriptable" local uis = game:GetService("UserInputService") local runservice = game:GetService("RunService") local colliding = false local map = workspace.Map local lastpos = camerapart.Position local walkspeed = 5 local holding = { w = false, a = false, s = false, d = false, } uis.InputBegan:Connect(function(input, typing) if typing then return end if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.Up or input.KeyCode == Enum.KeyCode.DPadUp then holding[1] = true end if input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.Left or input.KeyCode == Enum.KeyCode.DPadLeft then holding[2] = true end if input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.Down or input.KeyCode == Enum.KeyCode.DPadDown then holding[3] = true end if input.KeyCode == Enum.KeyCode.D or input.KeyCode == Enum.KeyCode.Right or input.KeyCode == Enum.KeyCode.DPadRight then holding[4] = true end end) uis.InputEnded:Connect(function(input, typing) if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.Up or input.KeyCode == Enum.KeyCode.DPadUp then holding[1] = false end if input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.Left or input.KeyCode == Enum.KeyCode.DPadLeft then holding[2] = false end if input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.Down or input.KeyCode == Enum.KeyCode.DPadDown then holding[3] = false end if input.KeyCode == Enum.KeyCode.D or input.KeyCode == Enum.KeyCode.Right or input.KeyCode == Enum.KeyCode.DPadRight then holding[4] = false end end) local function w(delta) local deltaSpeed = delta * walkspeed if not colliding then camerapart.CFrame = camerapart.CFrame * CFrame.new(0, 0, -deltaSpeed) owner.Character.RemoteEvent:FireServer(camerapart.CFrame) end end local function a(delta) local deltaSpeed = delta * walkspeed camerapart.CFrame = camerapart.CFrame * CFrame.Angles(0, deltaSpeed, 0) owner.Character.RemoteEvent:FireServer(camerapart.CFrame) end local function s(delta) local deltaSpeed = delta * walkspeed if not colliding then camerapart.CFrame = camerapart.CFrame * CFrame.new(0, 0, deltaSpeed) owner.Character.RemoteEvent:FireServer(camerapart.CFrame) end end local function d(delta) local deltaSpeed = delta * walkspeed camerapart.CFrame = camerapart.CFrame * CFrame.Angles(0, -deltaSpeed, 0) owner.Character.RemoteEvent:FireServer(camerapart.CFrame) end local function frameUpdated(delta) print("updatinating") camera.CFrame = camerapart.CFrame colliding = false for i, v in pairs(camerapart:GetTouchingParts()) do if v:IsDescendantOf(map) and not colliding then colliding = true camerapart.Position = lastpos end end lastpos = camerapart.Position if holding[1] then w(delta) end if holding[2] then a(delta) end if holding[3] then s(delta) end if holding[4] then d(delta) end end runservice:BindToRenderStep("RaycastUpdate",Enum.RenderPriority.Camera.Value,frameUpdated) -- Made by LikeableEmmec ]],owner.Character)
Editor Settings
Theme
Key bindings
Full width
Lines