Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local WRHax = Instance.new("ScreenGui")
- local Topbar = Instance.new("Frame")
- local TextLabel = Instance.new("TextLabel")
- local exitbut = Instance.new("TextButton")
- local minibut = Instance.new("TextButton")
- local Mainframe = Instance.new("Frame")
- local ImageLabel = Instance.new("ImageLabel")
- local wswitchframe = Instance.new("Frame")
- local weatherswitchbut = Instance.new("TextButton")
- local ultrabrite = Instance.new("Frame")
- local ultrabrightbut = Instance.new("TextButton")
- local waypointinfobut = Instance.new("TextButton")
- local waypointmenu = Instance.new("Frame")
- local keybindinfoframe = Instance.new("Frame")
- local keybindinfolab = Instance.new("TextLabel")
- local keybindexitbut = Instance.new("TextButton")
- local keybindinfolabel = Instance.new("TextLabel")
- local hangselfbut = Instance.new("TextButton")
- local lightningbut = Instance.new("TextButton")
- local spawnbikebut = Instance.new("TextButton")
- local player = game.Players.LocalPlayer
- local mouse = player:GetMouse()
- local character = nil
- local function getcharacter()
- return player.Character
- end
- bind = "b"
- bind2 = "v"
- tpx = Vector3.new(0, 0, 0)
- specbind = "z"
- specbind2 = "x"
- spectpx = Vector3.new(0, 0, 0)
- WRHax.Name = "WRHax"
- WRHax.Parent = game.CoreGui
- WRHax.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- Topbar.Name = "Topbar"
- Topbar.Parent = WRHax
- Topbar.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- Topbar.BorderColor3 = Color3.fromRGB(0, 0, 0)
- Topbar.BorderSizePixel = 0
- Topbar.Position = UDim2.new(0.183506668, 0, 0.336434126, 0)
- Topbar.Size = UDim2.new(0, 512, 0, 15)
- Topbar.ZIndex = 2
- TextLabel.Parent = Topbar
- TextLabel.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- TextLabel.BackgroundTransparency = 1.000
- TextLabel.BorderColor3 = Color3.fromRGB(0, 0, 0)
- TextLabel.Position = UDim2.new(0.0273972601, 0, 0.400000006, 0)
- TextLabel.Size = UDim2.new(0, 45, 0, 2)
- TextLabel.ZIndex = 3
- TextLabel.Font = Enum.Font.SourceSans
- TextLabel.Text = "Sweather_v1.2"
- TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- TextLabel.TextSize = 14.000
- exitbut.Name = "exitbut"
- exitbut.Parent = Topbar
- exitbut.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- exitbut.BorderColor3 = Color3.fromRGB(0, 0, 0)
- exitbut.BorderSizePixel = 0
- exitbut.Position = UDim2.new(0.960708141, 0, 0, 0)
- exitbut.Size = UDim2.new(0, 20, 0, 15)
- exitbut.ZIndex = 3
- exitbut.Font = Enum.Font.SourceSans
- exitbut.Text = "X"
- exitbut.TextColor3 = Color3.fromRGB(255, 255, 255)
- exitbut.TextScaled = true
- exitbut.TextSize = 14.000
- exitbut.TextWrapped = true
- minibut.Name = "minibut"
- minibut.Parent = Topbar
- minibut.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- minibut.BorderColor3 = Color3.fromRGB(0, 0, 0)
- minibut.BorderSizePixel = 0
- minibut.Position = UDim2.new(0.904071391, 0, 0, 0)
- minibut.Size = UDim2.new(0, 20, 0, 15)
- minibut.ZIndex = 3
- minibut.Font = Enum.Font.SourceSans
- minibut.Text = "-"
- minibut.TextColor3 = Color3.fromRGB(255, 255, 255)
- minibut.TextScaled = true
- minibut.TextSize = 14.000
- minibut.TextWrapped = true
- Mainframe.Name = "Mainframe"
- Mainframe.Parent = Topbar
- Mainframe.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- Mainframe.BorderColor3 = Color3.fromRGB(255, 255, 255)
- Mainframe.BorderSizePixel = 0
- Mainframe.Position = UDim2.new(0, 0, 0.999998987, 0)
- Mainframe.Size = UDim2.new(0, 512, 0, 256)
- Mainframe.ZIndex = 0
- ImageLabel.Parent = Mainframe
- ImageLabel.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- ImageLabel.BackgroundTransparency = 1.000
- ImageLabel.BorderSizePixel = 0
- ImageLabel.Size = UDim2.new(0, 512, 0, 256)
- ImageLabel.Image = "rbxgameasset://Images/sweather_ui_backround"
- ImageLabel.ImageColor3 = Color3.fromRGB(50, 50, 50)
- wswitchframe.Name = "wswitchframe"
- wswitchframe.Parent = Mainframe
- wswitchframe.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
- wswitchframe.BorderColor3 = Color3.fromRGB(255, 0, 0)
- wswitchframe.Position = UDim2.new(0.0489236787, 0, 0.05078125, 0)
- wswitchframe.Size = UDim2.new(0, 98, 0, 27)
- weatherswitchbut.Name = "weatherswitchbut"
- weatherswitchbut.Parent = wswitchframe
- weatherswitchbut.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- weatherswitchbut.BorderColor3 = Color3.fromRGB(167, 0, 0)
- weatherswitchbut.BorderSizePixel = 2
- weatherswitchbut.Size = UDim2.new(0, 98, 0, 27)
- weatherswitchbut.Font = Enum.Font.SourceSans
- weatherswitchbut.Text = "Toggle Weather"
- weatherswitchbut.TextColor3 = Color3.fromRGB(255, 255, 255)
- weatherswitchbut.TextSize = 14.000
- ultrabrite.Name = "ultrabrite"
- ultrabrite.Parent = Mainframe
- ultrabrite.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
- ultrabrite.BorderColor3 = Color3.fromRGB(0, 255, 0)
- ultrabrite.Position = UDim2.new(0.0489236712, 0, 0.1875, 0)
- ultrabrite.Size = UDim2.new(0, 97, 0, 27)
- ultrabrightbut.Name = "ultrabrightbut"
- ultrabrightbut.Parent = ultrabrite
- ultrabrightbut.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- ultrabrightbut.BorderColor3 = Color3.fromRGB(167, 0, 0)
- ultrabrightbut.BorderSizePixel = 2
- ultrabrightbut.Size = UDim2.new(0, 98, 0, 27)
- ultrabrightbut.Font = Enum.Font.SourceSans
- ultrabrightbut.Text = "Ultrabright"
- ultrabrightbut.TextColor3 = Color3.fromRGB(255, 255, 255)
- ultrabrightbut.TextSize = 14.000
- waypointinfobut.Name = "waypointinfobut"
- waypointinfobut.Parent = Mainframe
- waypointinfobut.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- waypointinfobut.BorderColor3 = Color3.fromRGB(167, 0, 0)
- waypointinfobut.BorderSizePixel = 2
- waypointinfobut.Position = UDim2.new(0, 25, 0, 84)
- waypointinfobut.Size = UDim2.new(0, 98, 0, 27)
- waypointinfobut.Font = Enum.Font.SourceSans
- waypointinfobut.Text = "Waypoint & Cinimatic Info"
- waypointinfobut.TextColor3 = Color3.fromRGB(255, 255, 255)
- waypointinfobut.TextScaled = true
- waypointinfobut.TextSize = 14.000
- waypointinfobut.TextWrapped = true
- waypointmenu.Name = "waypointmenu"
- waypointmenu.Parent = waypointinfobut
- waypointmenu.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- waypointmenu.BorderSizePixel = 0
- waypointmenu.Position = UDim2.new(5.08321047, 0, -3.66666675, 0)
- waypointmenu.Size = UDim2.new(0, 140, 0, 15)
- waypointmenu.Visible = false
- keybindinfoframe.Name = "keybindinfoframe"
- keybindinfoframe.Parent = waypointmenu
- keybindinfoframe.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- keybindinfoframe.BorderColor3 = Color3.fromRGB(27, 42, 53)
- keybindinfoframe.BorderSizePixel = 0
- keybindinfoframe.Position = UDim2.new(-0.00250331336, 0, 1, 0)
- keybindinfoframe.Size = UDim2.new(0, 140, 0, 84)
- keybindinfolab.Name = "keybindinfolab"
- keybindinfolab.Parent = keybindinfoframe
- keybindinfolab.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- keybindinfolab.BackgroundTransparency = 1.000
- keybindinfolab.BorderSizePixel = 0
- keybindinfolab.Size = UDim2.new(0, 140, 0, 84)
- keybindinfolab.Font = Enum.Font.SourceSans
- keybindinfolab.Text = "To set a waypoint, press B, to go to a waypoint, press V, and to toggle Cinematic mode, press Shift + P."
- keybindinfolab.TextColor3 = Color3.fromRGB(255, 255, 255)
- keybindinfolab.TextScaled = true
- keybindinfolab.TextSize = 14.000
- keybindinfolab.TextWrapped = true
- keybindexitbut.Name = "keybindexitbut"
- keybindexitbut.Parent = waypointmenu
- keybindexitbut.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- keybindexitbut.BorderColor3 = Color3.fromRGB(0, 0, 0)
- keybindexitbut.BorderSizePixel = 0
- keybindexitbut.Position = UDim2.new(0.857142866, 0, 0, 0)
- keybindexitbut.Size = UDim2.new(0, 20, 0, 15)
- keybindexitbut.ZIndex = 3
- keybindexitbut.Font = Enum.Font.SourceSans
- keybindexitbut.Text = "X"
- keybindexitbut.TextColor3 = Color3.fromRGB(255, 255, 255)
- keybindexitbut.TextScaled = true
- keybindexitbut.TextSize = 16.000
- keybindexitbut.TextWrapped = true
- keybindinfolabel.Name = "keybindinfolabel"
- keybindinfolabel.Parent = waypointmenu
- keybindinfolabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- keybindinfolabel.BackgroundTransparency = 1.000
- keybindinfolabel.BorderSizePixel = 0
- keybindinfolabel.Size = UDim2.new(0, 77, 0, 15)
- keybindinfolabel.Font = Enum.Font.SourceSans
- keybindinfolabel.Text = "Keybind Info"
- keybindinfolabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- keybindinfolabel.TextScaled = true
- keybindinfolabel.TextSize = 14.000
- keybindinfolabel.TextWrapped = true
- hangselfbut.Name = "hangselfbut"
- hangselfbut.Parent = Mainframe
- hangselfbut.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- hangselfbut.BorderColor3 = Color3.fromRGB(167, 0, 0)
- hangselfbut.BorderSizePixel = 2
- hangselfbut.Position = UDim2.new(0, 25, 0, 119)
- hangselfbut.Size = UDim2.new(0, 98, 0, 27)
- hangselfbut.Font = Enum.Font.SourceSans
- hangselfbut.Text = "Hang Self"
- hangselfbut.TextColor3 = Color3.fromRGB(255, 255, 255)
- hangselfbut.TextSize = 14.000
- lightningbut.Name = "lightningbut"
- lightningbut.Parent = Mainframe
- lightningbut.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- lightningbut.BorderColor3 = Color3.fromRGB(167, 0, 0)
- lightningbut.BorderSizePixel = 2
- lightningbut.Position = UDim2.new(0, 25, 0, 155)
- lightningbut.Size = UDim2.new(0, 98, 0, 27)
- lightningbut.Font = Enum.Font.SourceSans
- lightningbut.Text = "Lightning"
- lightningbut.TextColor3 = Color3.fromRGB(255, 255, 255)
- lightningbut.TextSize = 14.000
- spawnbikebut.Name = "spawnbikebut"
- spawnbikebut.Parent = Mainframe
- spawnbikebut.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- spawnbikebut.BorderColor3 = Color3.fromRGB(167, 0, 0)
- spawnbikebut.BorderSizePixel = 2
- spawnbikebut.Position = UDim2.new(0, 25, 0, 191)
- spawnbikebut.Size = UDim2.new(0, 98, 0, 27)
- spawnbikebut.Font = Enum.Font.SourceSans
- spawnbikebut.Text = "Spawn Bike"
- spawnbikebut.TextColor3 = Color3.fromRGB(255, 255, 255)
- spawnbikebut.TextSize = 14.000
- function quietkids(weatherscript)
- local children = weatherscript:GetChildren()
- for i = 1, #children do
- local child = children[i]
- if child:IsA("Sound") then
- child.Volume = 0
- end
- end
- end
- function loudkids(weatherscript)
- local children = weatherscript:GetChildren()
- for i = 1, #children do
- local child = children[i]
- if child:IsA("Sound") then
- child.Volume = 0.6
- end
- end
- end
- Topbar.MouseEnter:Connect(function()
- Topbar.Selectable = true
- Topbar.Active = true
- Topbar.Draggable = true
- end)
- Topbar.MouseLeave:Connect(function()
- Topbar.Selectable = false
- Topbar.Active = false
- Topbar.Draggable = false
- end)
- local function onexitbutButtonActivated()
- WRHax.Parent = nil
- end
- exitbut.Activated:Connect(onexitbutButtonActivated)
- exitbut.MouseEnter:Connect(function()
- exitbut.BackgroundColor3 = Color3.new(255, 0, 0)
- end)
- exitbut.MouseLeave:Connect(function()
- exitbut.BackgroundColor3 = Color3.new(0, 0, 0)
- end)
- minibuttoggled = false
- local function onminibutButtonActivated()
- if minibuttoggled == false then
- minibut.TextColor3 = Color3.new(255,0,0)
- Mainframe.Visible = false
- minibuttoggled = true
- else
- minibut.TextColor3 = Color3.new(255,255,255)
- Mainframe.Visible = true
- minibuttoggled = false
- end
- end
- minibut.Activated:Connect(onminibutButtonActivated)
- minibut.MouseEnter:Connect(function()
- minibut.BackgroundColor3 = Color3.new(255, 0, 0)
- end)
- minibut.MouseLeave:Connect(function()
- minibut.BackgroundColor3 = Color3.new(0, 0, 0)
- end)
- ultrabrightbuttoggled = false
- lightingvar = game.Lighting
- local function onultrabrightbutButtonActivated()
- if ultrabrightbuttoggled == false then
- ultrabrightbut.Position = UDim2.new(0, 30, 0, 0)
- lightingvar.Brightness = 10
- ultrabrightbuttoggled = true
- else
- ultrabrightbut.Position = UDim2.new(0, 0, 0, 0)
- lightingvar.Brightness = 1
- ultrabrightbuttoggled = false
- end
- end
- ultrabrightbut.Activated:Connect(onultrabrightbutButtonActivated)
- local function onwaypointinfobutButtonActivated()
- waypointinfobut.waypointmenu.Visible = true
- end
- waypointinfobut.Activated:Connect(onwaypointinfobutButtonActivated)
- local function onkeybindexitbutButtonActivated()
- waypointinfobut.waypointmenu.Visible = false
- end
- keybindexitbut.Activated:Connect(onkeybindexitbutButtonActivated)
- keybindexitbut.MouseEnter:Connect(function()
- keybindexitbut.BackgroundColor3 = Color3.new(255, 0, 0)
- end)
- keybindexitbut.MouseLeave:Connect(function()
- keybindexitbut.BackgroundColor3 = Color3.new(0, 0, 0)
- end)
- game.StarterGui:SetCore("SendNotification", {
- Title = "Spectator Camera + Waypoints";
- Text = "Successfully loaded Spectator Camera + Waypoints.";
- })
- game.StarterGui:SetCore("SendNotification", {
- Title = "SC + W Keybindings";
- Text = "Shift + P: Enter Spectator Camera, Z: Set a Waypoint at Camera's position, X: Teleport to Waypoint.";
- })
- mouse.KeyDown:connect(function(speckey)
- if speckey == specbind then
- spectpx = game:GetService("Workspace").CurrentCamera.CFrame.Position
- spectpxstr = "Successfully set a waypoint at your camera's location. " .. "(" .. tostring(spectpx) .. ")"
- game.StarterGui:SetCore("SendNotification", {
- Title = "Waypoints";
- Text = spectpxstr;
- })
- end
- end)
- mouse.KeyDown:connect(function(speckey)
- if speckey == specbind2 then
- getcharacter().HumanoidRootPart.CFrame = CFrame.new(spectpx)
- spectpxstr = "Successfully teleported you to your last waypoint. " .. "(" .. tostring(spectpx) .. ")"
- game.StarterGui:SetCore("SendNotification", {
- Title = "Waypoints";
- Text = spectpxstr;
- })
- end
- end)
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- LocalScript0 = Instance.new("LocalScript")
- LocalScript0.Name = "FreeCamera"
- LocalScript0.Parent = mas
- table.insert(cors,sandbox(LocalScript0,function()
- -----------------------------------------------------------------------
- -- Freecam
- -- Cinematic free camera for spectating and video production.
- ------------------------------------------------------------------------
- local pi = math.pi
- local abs = math.abs
- local clamp = math.clamp
- local exp = math.exp
- local rad = math.rad
- local sign = math.sign
- local sqrt = math.sqrt
- local tan = math.tan
- local ContextActionService = game:GetService("ContextActionService")
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local StarterGui = game:GetService("StarterGui")
- local UserInputService = game:GetService("UserInputService")
- local LocalPlayer = Players.LocalPlayer
- if not LocalPlayer then
- Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
- LocalPlayer = Players.LocalPlayer
- end
- local Camera = workspace.CurrentCamera
- workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function()
- local newCamera = workspace.CurrentCamera
- if newCamera then
- Camera = newCamera
- end
- end)
- ------------------------------------------------------------------------
- local TOGGLE_INPUT_PRIORITY = Enum.ContextActionPriority.Low.Value
- local INPUT_PRIORITY = Enum.ContextActionPriority.High.Value
- local FREECAM_MACRO_KB = {Enum.KeyCode.LeftShift, Enum.KeyCode.P}
- local NAV_GAIN = Vector3.new(1, 1, 1)*64
- local PAN_GAIN = Vector2.new(0.75, 1)*8
- local FOV_GAIN = 300
- local PITCH_LIMIT = rad(90)
- local VEL_STIFFNESS = 1.5
- local PAN_STIFFNESS = 1.0
- local FOV_STIFFNESS = 4.0
- ------------------------------------------------------------------------
- local Spring = {} do
- Spring.__index = Spring
- function Spring.new(freq, pos)
- local self = setmetatable({}, Spring)
- self.f = freq
- self.p = pos
- self.v = pos*0
- return self
- end
- function Spring:Update(dt, goal)
- local f = self.f*2*pi
- local p0 = self.p
- local v0 = self.v
- local offset = goal - p0
- local decay = exp(-f*dt)
- local p1 = goal + (v0*dt - offset*(f*dt + 1))*decay
- local v1 = (f*dt*(offset*f - v0) + v0)*decay
- self.p = p1
- self.v = v1
- return p1
- end
- function Spring:Reset(pos)
- self.p = pos
- self.v = pos*0
- end
- end
- ------------------------------------------------------------------------
- local cameraPos = Vector3.new()
- local cameraRot = Vector2.new()
- local cameraFov = 0
- local velSpring = Spring.new(VEL_STIFFNESS, Vector3.new())
- local panSpring = Spring.new(PAN_STIFFNESS, Vector2.new())
- local fovSpring = Spring.new(FOV_STIFFNESS, 0)
- ------------------------------------------------------------------------
- local Input = {} do
- local thumbstickCurve do
- local K_CURVATURE = 2.0
- local K_DEADZONE = 0.15
- local function fCurve(x)
- return (exp(K_CURVATURE*x) - 1)/(exp(K_CURVATURE) - 1)
- end
- local function fDeadzone(x)
- return fCurve((x - K_DEADZONE)/(1 - K_DEADZONE))
- end
- function thumbstickCurve(x)
- return sign(x)*clamp(fDeadzone(abs(x)), 0, 1)
- end
- end
- local gamepad = {
- ButtonX = 0,
- ButtonY = 0,
- DPadDown = 0,
- DPadUp = 0,
- ButtonL2 = 0,
- ButtonR2 = 0,
- Thumbstick1 = Vector2.new(),
- Thumbstick2 = Vector2.new(),
- }
- local keyboard = {
- W = 0,
- A = 0,
- S = 0,
- D = 0,
- E = 0,
- Q = 0,
- U = 0,
- H = 0,
- J = 0,
- K = 0,
- I = 0,
- Y = 0,
- Up = 0,
- Down = 0,
- LeftShift = 0,
- RightShift = 0,
- }
- local mouse = {
- Delta = Vector2.new(),
- MouseWheel = 0,
- }
- local NAV_GAMEPAD_SPEED = Vector3.new(1, 1, 1)
- local NAV_KEYBOARD_SPEED = Vector3.new(1, 1, 1)
- local PAN_MOUSE_SPEED = Vector2.new(1, 1)*(pi/64)
- local PAN_GAMEPAD_SPEED = Vector2.new(1, 1)*(pi/8)
- local FOV_WHEEL_SPEED = 1.0
- local FOV_GAMEPAD_SPEED = 0.25
- local NAV_ADJ_SPEED = 0.75
- local NAV_SHIFT_MUL = 5
- local navSpeed = 1
- function Input.Vel(dt)
- navSpeed = clamp(navSpeed + dt*(keyboard.Up - keyboard.Down)*NAV_ADJ_SPEED, 0.01, 4)
- local kGamepad = Vector3.new(
- thumbstickCurve(gamepad.Thumbstick1.x),
- thumbstickCurve(gamepad.ButtonR2) - thumbstickCurve(gamepad.ButtonL2),
- thumbstickCurve(-gamepad.Thumbstick1.y)
- )*NAV_GAMEPAD_SPEED
- local kKeyboard = Vector3.new(
- keyboard.D - keyboard.A + keyboard.K - keyboard.H,
- keyboard.E - keyboard.Q + keyboard.I - keyboard.Y,
- keyboard.S - keyboard.W + keyboard.J - keyboard.U
- )*NAV_KEYBOARD_SPEED
- local shift = UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) or UserInputService:IsKeyDown(Enum.KeyCode.RightShift)
- return (kGamepad + kKeyboard)*(navSpeed*(shift and NAV_SHIFT_MUL or 1))
- end
- function Input.Pan(dt)
- local kGamepad = Vector2.new(
- thumbstickCurve(gamepad.Thumbstick2.y),
- thumbstickCurve(-gamepad.Thumbstick2.x)
- )*PAN_GAMEPAD_SPEED
- local kMouse = mouse.Delta*PAN_MOUSE_SPEED
- mouse.Delta = Vector2.new()
- return kGamepad + kMouse
- end
- function Input.Fov(dt)
- local kGamepad = (gamepad.ButtonX - gamepad.ButtonY)*FOV_GAMEPAD_SPEED
- local kMouse = mouse.MouseWheel*FOV_WHEEL_SPEED
- mouse.MouseWheel = 0
- return kGamepad + kMouse
- end
- do
- local function Keypress(action, state, input)
- keyboard[input.KeyCode.Name] = state == Enum.UserInputState.Begin and 1 or 0
- return Enum.ContextActionResult.Sink
- end
- local function GpButton(action, state, input)
- gamepad[input.KeyCode.Name] = state == Enum.UserInputState.Begin and 1 or 0
- return Enum.ContextActionResult.Sink
- end
- local function MousePan(action, state, input)
- local delta = input.Delta
- mouse.Delta = Vector2.new(-delta.y, -delta.x)
- return Enum.ContextActionResult.Sink
- end
- local function Thumb(action, state, input)
- gamepad[input.KeyCode.Name] = input.Position
- return Enum.ContextActionResult.Sink
- end
- local function Trigger(action, state, input)
- gamepad[input.KeyCode.Name] = input.Position.z
- return Enum.ContextActionResult.Sink
- end
- local function MouseWheel(action, state, input)
- mouse[input.UserInputType.Name] = -input.Position.z
- return Enum.ContextActionResult.Sink
- end
- local function Zero(t)
- for k, v in pairs(t) do
- t[k] = v*0
- end
- end
- function Input.StartCapture()
- ContextActionService:BindActionAtPriority("FreecamKeyboard", Keypress, false, INPUT_PRIORITY,
- Enum.KeyCode.W, Enum.KeyCode.U,
- Enum.KeyCode.A, Enum.KeyCode.H,
- Enum.KeyCode.S, Enum.KeyCode.J,
- Enum.KeyCode.D, Enum.KeyCode.K,
- Enum.KeyCode.E, Enum.KeyCode.I,
- Enum.KeyCode.Q, Enum.KeyCode.Y,
- Enum.KeyCode.Up, Enum.KeyCode.Down
- )
- ContextActionService:BindActionAtPriority("FreecamMousePan", MousePan, false, INPUT_PRIORITY, Enum.UserInputType.MouseMovement)
- ContextActionService:BindActionAtPriority("FreecamMouseWheel", MouseWheel, false, INPUT_PRIORITY, Enum.UserInputType.MouseWheel)
- ContextActionService:BindActionAtPriority("FreecamGamepadButton", GpButton, false, INPUT_PRIORITY, Enum.KeyCode.ButtonX, Enum.KeyCode.ButtonY)
- ContextActionService:BindActionAtPriority("FreecamGamepadTrigger", Trigger, false, INPUT_PRIORITY, Enum.KeyCode.ButtonR2, Enum.KeyCode.ButtonL2)
- ContextActionService:BindActionAtPriority("FreecamGamepadThumbstick", Thumb, false, INPUT_PRIORITY, Enum.KeyCode.Thumbstick1, Enum.KeyCode.Thumbstick2)
- end
- function Input.StopCapture()
- navSpeed = 1
- Zero(gamepad)
- Zero(keyboard)
- Zero(mouse)
- ContextActionService:UnbindAction("FreecamKeyboard")
- ContextActionService:UnbindAction("FreecamMousePan")
- ContextActionService:UnbindAction("FreecamMouseWheel")
- ContextActionService:UnbindAction("FreecamGamepadButton")
- ContextActionService:UnbindAction("FreecamGamepadTrigger")
- ContextActionService:UnbindAction("FreecamGamepadThumbstick")
- end
- end
- end
- local function GetFocusDistance(cameraFrame)
- local znear = 0.1
- local viewport = Camera.ViewportSize
- local projy = 2*tan(cameraFov/2)
- local projx = viewport.x/viewport.y*projy
- local fx = cameraFrame.rightVector
- local fy = cameraFrame.upVector
- local fz = cameraFrame.lookVector
- local minVect = Vector3.new()
- local minDist = 512
- for x = 0, 1, 0.5 do
- for y = 0, 1, 0.5 do
- local cx = (x - 0.5)*projx
- local cy = (y - 0.5)*projy
- local offset = fx*cx - fy*cy + fz
- local origin = cameraFrame.p + offset*znear
- local part, hit = workspace:FindPartOnRay(Ray.new(origin, offset.unit*minDist))
- local dist = (hit - origin).magnitude
- if minDist > dist then
- minDist = dist
- minVect = offset.unit
- end
- end
- end
- return fz:Dot(minVect)*minDist
- end
- ------------------------------------------------------------------------
- local function StepFreecam(dt)
- local vel = velSpring:Update(dt, Input.Vel(dt))
- local pan = panSpring:Update(dt, Input.Pan(dt))
- local fov = fovSpring:Update(dt, Input.Fov(dt))
- local zoomFactor = sqrt(tan(rad(70/2))/tan(rad(cameraFov/2)))
- cameraFov = clamp(cameraFov + fov*FOV_GAIN*(dt/zoomFactor), 1, 120)
- cameraRot = cameraRot + pan*PAN_GAIN*(dt/zoomFactor)
- cameraRot = Vector2.new(clamp(cameraRot.x, -PITCH_LIMIT, PITCH_LIMIT), cameraRot.y%(2*pi))
- local cameraCFrame = CFrame.new(cameraPos)*CFrame.fromOrientation(cameraRot.x, cameraRot.y, 0)*CFrame.new(vel*NAV_GAIN*dt)
- cameraPos = cameraCFrame.p
- Camera.CFrame = cameraCFrame
- Camera.Focus = cameraCFrame*CFrame.new(0, 0, -GetFocusDistance(cameraCFrame))
- Camera.FieldOfView = cameraFov
- end
- ------------------------------------------------------------------------
- local PlayerState = {} do
- local mouseIconEnabled
- local cameraSubject
- local cameraType
- local cameraFocus
- local cameraCFrame
- local cameraFieldOfView
- local screenGuis = {}
- local coreGuis = {
- Backpack = true,
- Chat = true,
- Health = true,
- PlayerList = true,
- }
- local setCores = {
- BadgesNotificationsActive = true,
- PointsNotificationsActive = true,
- }
- -- Save state and set up for freecam
- function PlayerState.Push()
- for name in pairs(coreGuis) do
- coreGuis[name] = StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType[name])
- StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType[name], false)
- end
- for name in pairs(setCores) do
- setCores[name] = StarterGui:GetCore(name)
- StarterGui:SetCore(name, false)
- end
- local playergui = LocalPlayer:FindFirstChildOfClass("PlayerGui")
- if playergui then
- for _, gui in pairs(playergui:GetChildren()) do
- if gui:IsA("ScreenGui") and gui.Enabled then
- screenGuis[#screenGuis + 1] = gui
- gui.Enabled = false
- end
- end
- end
- cameraFieldOfView = Camera.FieldOfView
- Camera.FieldOfView = 70
- cameraType = Camera.CameraType
- Camera.CameraType = Enum.CameraType.Custom
- cameraSubject = Camera.CameraSubject
- Camera.CameraSubject = nil
- cameraCFrame = Camera.CFrame
- cameraFocus = Camera.Focus
- mouseIconEnabled = UserInputService.MouseIconEnabled
- UserInputService.MouseIconEnabled = false
- mouseBehavior = UserInputService.MouseBehavior
- UserInputService.MouseBehavior = Enum.MouseBehavior.Default
- end
- -- Restore state
- function PlayerState.Pop()
- for name, isEnabled in pairs(coreGuis) do
- StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType[name], isEnabled)
- end
- for name, isEnabled in pairs(setCores) do
- StarterGui:SetCore(name, isEnabled)
- end
- for _, gui in pairs(screenGuis) do
- if gui.Parent then
- gui.Enabled = true
- end
- end
- Camera.FieldOfView = cameraFieldOfView
- cameraFieldOfView = nil
- Camera.CameraType = cameraType
- cameraType = nil
- Camera.CameraSubject = cameraSubject
- cameraSubject = nil
- Camera.CFrame = cameraCFrame
- cameraCFrame = nil
- Camera.Focus = cameraFocus
- cameraFocus = nil
- UserInputService.MouseIconEnabled = mouseIconEnabled
- mouseIconEnabled = nil
- UserInputService.MouseBehavior = mouseBehavior
- mouseBehavior = nil
- end
- end
- local function StartFreecam()
- local cameraCFrame = Camera.CFrame
- cameraRot = Vector2.new(cameraCFrame:toEulerAnglesYXZ())
- cameraPos = cameraCFrame.p
- cameraFov = Camera.FieldOfView
- velSpring:Reset(Vector3.new())
- panSpring:Reset(Vector2.new())
- fovSpring:Reset(0)
- PlayerState.Push()
- RunService:BindToRenderStep("Freecam", Enum.RenderPriority.Camera.Value, StepFreecam)
- Input.StartCapture()
- end
- local function StopFreecam()
- Input.StopCapture()
- RunService:UnbindFromRenderStep("Freecam")
- PlayerState.Pop()
- end
- ------------------------------------------------------------------------
- do
- local enabled = false
- local function ToggleFreecam()
- if enabled then
- StopFreecam()
- else
- StartFreecam()
- end
- enabled = not enabled
- end
- local function CheckMacro(macro)
- for i = 1, #macro - 1 do
- if not UserInputService:IsKeyDown(macro[i]) then
- return
- end
- end
- ToggleFreecam()
- end
- local function HandleActivationInput(action, state, input)
- if state == Enum.UserInputState.Begin then
- if input.KeyCode == FREECAM_MACRO_KB[#FREECAM_MACRO_KB] then
- CheckMacro(FREECAM_MACRO_KB)
- end
- end
- return Enum.ContextActionResult.Pass
- end
- ContextActionService:BindActionAtPriority("FreecamToggle", HandleActivationInput, false, TOGGLE_INPUT_PRIORITY, FREECAM_MACRO_KB[#FREECAM_MACRO_KB])
- end
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.PlayerGui
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
- game.StarterGui:SetCore("SendNotification", {
- Title = "Waypoints";
- Text = "Successfully loaded Waypoints.";
- })
- game.StarterGui:SetCore("SendNotification", {
- Title = "Waypoint Keybindings";
- Text = "B: Set a Waypoint at your position, V: Teleport to Waypoint.";
- })
- mouse.KeyDown:connect(function(key)
- if key == bind then
- tpx = getcharacter().HumanoidRootPart.Position
- tpxstr = "Successfully set a waypoint at your position. " .. "(" .. tostring(tpx) .. ")"
- game.StarterGui:SetCore("SendNotification", {
- Title = "Waypoints";
- Text = tpxstr;
- })
- end
- end)
- mouse.KeyDown:connect(function(key)
- if key == bind2 then
- getcharacter().HumanoidRootPart.CFrame = CFrame.new(tpx)
- tpxstr = "Successfully teleported you to your last waypoint. " .. "(" .. tostring(tpx) .. ")"
- game.StarterGui:SetCore("SendNotification", {
- Title = "Waypoints";
- Text = tpxstr;
- })
- end
- end)
- local getcamera = game.Workspace.Camera
- local coregui = game.CoreGui
- local getlighting = game.Lighting
- local lplayer = game.Players.LocalPlayer
- local lcharacter = lplayer.Character
- local lplayergui = lplayer.PlayerGui
- local weatherstatus = true
- local function muteweather()
- local weathernoise = lplayergui:FindFirstChild("Weather")
- if weathernoise ~= nil then
- quietkids(weathernoise)
- weathernoise.Parent = coregui
- end
- local weather2noise = lplayergui:FindFirstChild("weather2")
- if weather2noise ~= nil then
- quietkids(weather2noise)
- weather2noise.Parent = coregui
- end
- local lightningnoise = lplayergui:FindFirstChild("Lightning")
- if lightningnoise ~= nil then
- quietkids(lightningnoise)
- lightningnoise.Parent = coregui
- end
- end
- local function nofog()
- getlighting.FogEnd = 1000000
- getlighting.Brightness = 1
- getlighting.OutdoorAmbient = Color3.new(0,0,0)
- local skycover = getcamera:FindFirstChild("SkyCover")
- if skycover ~= nil then
- skycover.Parent = coregui
- end
- local cclearsky = getlighting:FindFirstChild("Clearsky")
- if cclearsky ~= nil then
- cclearsky.Parent = coregui
- end
- local catmo = getlighting:FindFirstChild("Atmosphere")
- if catmo ~= nil then
- catmo.Parent = coregui
- end
- end
- local function nosnowstorm()
- local snowstorm = getcamera:FindFirstChild("SnowstormEffect")
- if snowstorm ~= nil then
- snowstorm.Parent = coregui
- end
- end
- local function norain()
- local rain = getcamera:FindFirstChild("RainEffect")
- if rain ~= nil then
- rain.Parent = coregui
- end
- end
- local function nosnow()
- local snow = getcamera:FindFirstChild("SnowEffect")
- if snow ~= nil then
- snow.Parent = coregui
- end
- end
- local function nostorm()
- local storm = getcamera:FindFirstChild("StormEffect")
- if storm ~= nil then
- storm.Parent = coregui
- end
- end
- local function noflurries()
- local flurries = getcamera:FindFirstChild("FlurriesEffect")
- if flurries ~= nil then
- flurries.Parent = coregui
- end
- end
- local function nosprinkles()
- local sprinkles = getcamera:FindFirstChild("SprinklesEffect")
- if sprinkles ~= nil then
- sprinkles.Parent = coregui
- end
- end
- local function noweather()
- muteweather()
- nofog()
- norain()
- nosnowstorm()
- nosnow()
- nostorm()
- noflurries()
- nosprinkles()
- end
- local function soundweather()
- local weathernoise = coregui:FindFirstChild("Weather")
- if weathernoise ~= nil then
- loudkids(weathernoise)
- weathernoise.Parent = lplayergui
- end
- local weather2noise = coregui:FindFirstChild("weather2")
- if weather2noise ~= nil then
- loudkids(weather2noise)
- weather2noise.Parent = lplayergui
- end
- local lightningnoise = coregui:FindFirstChild("Lightning")
- if lightningnoise ~= nil then
- loudkids(lightningnoise)
- lightningnoise.Parent = lplayergui
- end
- end
- local function yesfog()
- getlighting.FogEnd = 1000000
- getlighting.Brightness = 1
- getlighting.OutdoorAmbient = Color3.new(0,0,0)
- local skycover = coregui:FindFirstChild("SkyCover")
- if skycover ~= nil then
- skycover.Parent = getcamera
- end
- local cclearsky = coregui:FindFirstChild("Clearsky")
- if cclearsky ~= nil then
- cclearsky.Parent = getlighting
- end
- local catmo = coregui:FindFirstChild("Atmosphere")
- if catmo ~= nil then
- catmo.Parent = getlighting
- end
- end
- local function yessnowstorm()
- local snowstorm = coregui:FindFirstChild("SnowstormEffect")
- if snowstorm ~= nil then
- snowstorm.Parent = getcamera
- end
- end
- local function yesrain()
- local rain = coregui:FindFirstChild("RainEffect")
- if rain ~= nil then
- rain.Parent = getcamera
- end
- end
- local function yessnow()
- local snow = coregui:FindFirstChild("SnowEffect")
- if snow ~= nil then
- snow.Parent = getcamera
- end
- end
- local function yesstorm()
- local storm = coregui:FindFirstChild("StormEffect")
- if storm ~= nil then
- storm.Parent = getcamera
- end
- end
- local function yesflurries()
- local flurries = coregui:FindFirstChild("FlurriesEffect")
- if flurries ~= nil then
- flurries.Parent = getcamera
- end
- end
- local function yessprinkles()
- local sprinkles = coregui:FindFirstChild("SprinklesEffect")
- if sprinkles ~= nil then
- sprinkles.Parent = getcamera
- end
- end
- local function yesweather()
- soundweather()
- yesfog()
- yesrain()
- yessnowstorm()
- yessnow()
- yesstorm()
- yesflurries()
- yessprinkles()
- end
- weatherswitchbuttoggled = false
- local function onweatherswitchbutButtonActivated()
- if weatherswitchbuttoggled == false then
- weatherswitchbut.Position = UDim2.new(0, 30, 0, 0)
- noweather()
- weatherswitchbuttoggled = true
- else
- weatherswitchbut.Position = UDim2.new(0, 0, 0, 0)
- yesweather()
- weatherswitchbuttoggled = false
- end
- end
- weatherswitchbut.Activated:Connect(onweatherswitchbutButtonActivated)
- local function onhangselfbutButtonActivated()
- game:GetService("ReplicatedStorage").Remotes.Misc.CrowStatue:FireServer(workspace.CrowStatue.Activate.Dialog.wat.time.Dimensions.Alien.Dialogue.death)
- end
- hangselfbut.Activated:Connect(onhangselfbutButtonActivated)
- local function onlightningbutButtonActivated()
- local player = game.Players.LocalPlayer
- local character = player.Character
- local getHRP = character.HumanoidRootPart.Position
- game:GetService("ReplicatedStorage").Remotes.Misc.FoxStatue:FireServer(getHRP, getHRP, workspace.fox.rig2.fox.Dialog.DialogChoice.Grr)
- end
- lightningbut.Activated:Connect(onlightningbutButtonActivated)
- local function onspawnbikebutButtonActivated()
- game:GetService("ReplicatedStorage").Remotes["Bike Systems"]["Spawn Bike"]:FireServer()
- end
- spawnbikebut.Activated:Connect(onspawnbikebutButtonActivated)
Advertisement
Add Comment
Please, Sign In to add comment