Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script.Parent = nil
- local plr = owner
- local char = plr.Character
- local head
- if char then
- head = char:FindFirstChild("Head")
- end
- local remote,ls
- local lpos = CFrame.new()
- local lrot = CFrame.Angles(0,0,0)
- if head then
- lpos = head.CFrame
- end
- --//=================================\\
- --|| SAZERENOS' ARTIFICIAL HEARTBEAT
- --\\=================================//
- ArtificialHB = Instance.new("BindableEvent", script)
- ArtificialHB.Name = "ArtificialHB"
- script:WaitForChild("ArtificialHB")
- frame = (1/60)
- tf = 0
- allowframeloss = false
- tossremainder = false
- lastframe = tick()
- script.ArtificialHB:Fire()
- game:GetService("RunService").Heartbeat:connect(function(s, p)
- tf = tf + s
- if tf >= frame then
- if allowframeloss then
- script.ArtificialHB:Fire()
- lastframe = tick()
- else
- for i = 1, math.floor(tf / frame) do
- script.ArtificialHB:Fire()
- end
- lastframe = tick()
- end
- if tossremainder then
- tf = 0
- else
- tf = tf - frame * math.floor(tf / frame)
- end
- end
- end)
- function Swait(NUMBER)
- if NUMBER == 0 or NUMBER == nil then
- ArtificialHB.Event:wait()
- else
- for i = 1, NUMBER do
- ArtificialHB.Event:wait()
- end
- end
- end
- --//=================================\\
- --\\=================================//
- function create_char()
- if not char or not char.Parent then
- char = Instance.new("Model")
- char.Name = plr.Name
- --end
- --if not head or not head.Parent then
- head = Instance.new("Part")
- head.Name = (plr.Name .. "Freecam Head")
- head.Parent = char
- head.Transparency = 1
- head.Position = lpos.Position
- head.Size = Vector3.new(0.05, 0.05, 0.05)
- head.Anchored = true
- head.CanCollide = false
- head.Locked = true
- head.Massless = true
- head.ChildAdded:Connect(function(v)
- if v:IsA("SphereHandleAdornment") or v:IsA("ConeHandleAdornment") or v:IsA("CylinderHandleAdornment") then else
- v:Destroy()
- end
- end)
- local ConeHandleAdornment0 = Instance.new("ConeHandleAdornment")
- local CylinderHandleAdornment1 = Instance.new("CylinderHandleAdornment")
- local SphereHandleAdornment2 = Instance.new("SphereHandleAdornment")
- ConeHandleAdornment0.Parent = head
- ConeHandleAdornment0.Color = BrickColor.new("Really red")
- ConeHandleAdornment0.Transparency = 0.5
- ConeHandleAdornment0.Radius = 0.3
- ConeHandleAdornment0.Color3 = Color3.new(1, 0, 0)
- ConeHandleAdornment0.Adornee = head
- ConeHandleAdornment0.AlwaysOnTop = true
- ConeHandleAdornment0.SizeRelativeOffset = Vector3.new(0, 0, -55)
- ConeHandleAdornment0.Height = 0.8
- CylinderHandleAdornment1.Parent = head
- CylinderHandleAdornment1.Color = BrickColor.new("Really red")
- CylinderHandleAdornment1.Transparency = 0.5
- CylinderHandleAdornment1.Radius = 0.15
- CylinderHandleAdornment1.Color3 = Color3.new(1, 0, 0)
- CylinderHandleAdornment1.Adornee = head
- CylinderHandleAdornment1.AlwaysOnTop = true
- CylinderHandleAdornment1.SizeRelativeOffset = Vector3.new(0, 0, 5)
- CylinderHandleAdornment1.Height = 3
- SphereHandleAdornment2.Parent = head
- SphereHandleAdornment2.Color = BrickColor.new("Really red")
- SphereHandleAdornment2.Transparency = 0.7
- SphereHandleAdornment2.Color3 = Color3.new(1, 0, 0)
- SphereHandleAdornment2.Adornee = head
- --end
- --if not head:FindFirstChildOfClass('BillboardGui') then
- local BillboardGui0 = Instance.new("BillboardGui")
- local TextBox1 = Instance.new("TextBox")
- BillboardGui0.Parent = head
- BillboardGui0.Size = UDim2.new(0, 200, 1, 0)
- BillboardGui0.Active = true
- BillboardGui0.ClipsDescendants = true
- BillboardGui0.AlwaysOnTop = true
- TextBox1.Name = "name"
- TextBox1.Parent = BillboardGui0
- TextBox1.Size = UDim2.new(1, 0, 1, 0)
- TextBox1.BackgroundColor = BrickColor.new("Institutional white")
- TextBox1.BackgroundColor3 = Color3.new(1, 1, 1)
- TextBox1.BackgroundTransparency = 1
- TextBox1.BorderSizePixel = 0
- TextBox1.ZIndex = 2
- TextBox1.Font = Enum.Font.SourceSansBold
- TextBox1.FontSize = Enum.FontSize.Size14
- TextBox1.Text = plr.Name
- TextBox1.TextColor = BrickColor.new("Institutional white")
- TextBox1.TextColor3 = Color3.new(1, 1, 1)
- TextBox1.TextScaled = true
- TextBox1.TextSize = 14
- TextBox1.TextStrokeTransparency = 0
- TextBox1.TextWrap = true
- TextBox1.TextWrapped = true
- end
- char.Parent = workspace
- plr.Character = char
- end
- function create_nls_remote()
- if plr then else return end
- if not remote or not remote.Parent then
- remote = Instance.new("RemoteEvent")
- remote.Parent = plr['PlayerGui']
- remote.OnServerEvent:Connect(function(lplr,pos,_lrot)
- if (plr == lplr) then else return end
- if pos then
- lpos = pos
- end
- if _lrot then
- lrot = _lrot
- end
- end)
- end
- if not ls or not ls.Parent then
- NLS([[
- local plr = game:GetService("Players").LocalPlayer
- local char = plr.Character
- local head
- if char then
- head = char:FindFirstChild("Head")
- end
- local RS = game:GetService("RunService")
- local TS = game:GetService("TweenService")
- local UIS = game:GetService("UserInputService")
- local remote = script.parent
- local camera = workspace.CurrentCamera
- camera.CameraType = Enum.CameraType.Custom
- plr.CameraMode = Enum.CameraMode.LockFirstPerson
- local moving = {}
- local mv = 0
- local max = 0.8
- local smooth = 0.1
- local lpos = CFrame.new()
- local lrot = CFrame.Angles(camera.CFrame:toEulerAnglesXYZ())
- if head then
- lpos = head.CFrame
- end
- local fake_head
- function make_head()
- if fake_head then fake_head:Destroy(); end;
- fake_head = Instance.new("Part")
- fake_head.Name = (plr.Name .. "Freecam Head")
- fake_head.Parent = workspace
- fake_head.Transparency = 1
- fake_head.Position = lpos.Position
- fake_head.Size = Vector3.new(0.05, 0.05, 0.05)
- fake_head.Anchored = true
- fake_head.CanCollide = false
- fake_head.Locked = true
- fake_head.Massless = true
- end
- UIS.InputBegan:Connect(function(Input, Core)
- if not Core then else return end
- local mode = true
- if Input.UserInputType == Enum.UserInputType.Keyboard and Input.KeyCode then
- if Input.KeyCode == Enum.KeyCode.W then
- moving['w'] = mode
- elseif Input.KeyCode == Enum.KeyCode.A then
- moving['a'] = mode
- elseif Input.KeyCode == Enum.KeyCode.S then
- moving['s'] = mode
- elseif Input.KeyCode == Enum.KeyCode.D then
- moving['d'] = mode
- elseif Input.KeyCode == Enum.KeyCode.Space then
- moving['space'] = mode
- elseif Input.KeyCode == Enum.KeyCode.LeftControl then
- moving['control'] = mode
- elseif Input.KeyCode == Enum.KeyCode.LeftShift then
- moving['shift'] = mode
- end
- end
- end)
- UIS.InputChanged:Connect(function(Input, Core)
- if not Core then else return end
- local mode = true
- if Input.UserInputType == Enum.UserInputType.MouseWheel then
- local cfv = CFrame.new(0,0,-(max*10*1.5)*Input.Position.Z)
- if head then
- lrot = CFrame.Angles(camera.CFrame:toEulerAnglesXYZ())
- end
- lpos = (CFrame.new(lpos.p)*lrot)*cfv
- if fake_head then
- moveto(lpos,0.5)
- end
- end
- end)
- UIS.InputEnded:Connect(function(Input, Core)
- if not Core then else return end
- local mode = false
- if Input.UserInputType == Enum.UserInputType.Keyboard and Input.KeyCode then
- if Input.KeyCode == Enum.KeyCode.W then
- moving['w'] = mode
- elseif Input.KeyCode == Enum.KeyCode.A then
- moving['a'] = mode
- elseif Input.KeyCode == Enum.KeyCode.S then
- moving['s'] = mode
- elseif Input.KeyCode == Enum.KeyCode.D then
- moving['d'] = mode
- elseif Input.KeyCode == Enum.KeyCode.Space then
- moving['space'] = mode
- elseif Input.KeyCode == Enum.KeyCode.LeftControl then
- moving['control'] = mode
- elseif Input.KeyCode == Enum.KeyCode.LeftShift then
- moving['shift'] = mode
- end
- end
- end)
- spawn(function()
- RS.RenderStepped:Connect(function()
- if not fake_head or not fake_head.Parent then
- make_head()
- end
- if lpos ~= CFrame.new() then
- remote:FireServer(lpos,lrot)
- end
- if fake_head then
- fake_head.Anchored = true
- fake_head.CanCollide = false
- fake_head.Massless = false
- camera.CameraSubject = fake_head
- fake_head:ClearAllChildren()
- end
- if not char or not char.Parent or not head or not head.Parent then
- char = plr.Character
- if char then
- head = char:FindFirstChild(plr.Name .. "Freecam Head")
- if head then
- camera.CFrame = lpos -- CFrame.new(head.Position)*lrot
- end
- end
- end
- if head then
- head.Transparency = 1
- for i,v in pairs(head:GetChildren()) do
- if v:IsA("SphereHandleAdornment") or v:IsA("ConeHandleAdornment") or v:IsA("CylinderHandleAdornment") then
- v.Visible = false
- end
- if v:IsA("BillboardGui") or v:IsA("SurfaceGui") then
- v.Enabled = false
- end
- if v:IsA("BasePart") then
- v.Transparency = 1
- end
- end
- end
- end)
- end)
- function moveto(cf,s)
- game:GetService("TweenService"):Create(fake_head,TweenInfo.new(s),{CFrame = cf}):Play()
- end
- RS.RenderStepped:Connect(function()
- local cfv = CFrame.new()
- local raw_cfv = CFrame.new()
- local pressing = false
- local shifting = false
- local fell = false
- for key,mode in pairs(moving) do
- if key and mode == true then
- pressing = true
- if key == 'shift' then
- shifting = true
- end
- end
- end
- if pressing then
- if shifting then
- mv = mv + (smooth/4)
- if mv > (max/4) then
- mv = (max/4)
- end
- elseif not shifting then
- mv = mv + smooth
- if mv > max then
- mv = max
- end
- end
- elseif not pressing then
- mv = mv - (smooth*2)
- if 0 > mv then
- mv = 0
- end
- end
- for key,mode in pairs(moving) do
- if key and mode == true then
- if key == 'w' then
- cfv = cfv*CFrame.new(0,0,-mv)
- elseif key == 'a' then
- cfv = cfv*CFrame.new(-mv,0,0)
- elseif key == 's' then
- cfv = cfv*CFrame.new(0,0,mv)
- elseif key == 'd' then
- cfv = cfv*CFrame.new(mv,0,0)
- elseif key == 'space' then
- raw_cfv = raw_cfv*CFrame.new(0,mv,0)
- elseif key == 'control' then
- raw_cfv = raw_cfv*CFrame.new(0,-mv,0)
- end
- end
- end
- if head then
- lrot = CFrame.Angles(camera.CFrame:toEulerAnglesXYZ())
- end
- if fake_head and (workspace.FallenPartsDestroyHeight + 30) > fake_head.Position.Y then
- fell = true
- fake_head.Position = Vector3.new(fake_head.Position.X,10,fake_head.Position.Z)
- lpos = ((CFrame.new(fake_head.Position)*raw_cfv)*lrot)*cfv
- end
- if not fell then
- lpos = ((CFrame.new(lpos.p)*raw_cfv)*lrot)*cfv
- end
- if fake_head then
- moveto(lpos,0.5)
- end
- wait(0.1)
- end)
- ]],remote)
- ls = remote:FindFirstChildOfClass('LocalScript')
- end
- end
- if plr.Character then
- plr.Character:Destroy()
- end
- function moveto(cf,s)
- game:GetService("TweenService"):Create(head,TweenInfo.new(s),{CFrame = cf}):Play()
- end
- spawn(function()
- while wait(0.1) do
- create_nls_remote()
- end
- end)
- warn([[
- = FreeCam v1.5 =
- = Made by KrYn0MoRe =
- == CONTROLS ==
- W - Foward
- A - Left
- S - Backward
- D - Right
- Left Control - Down
- Space - Up
- Scroll Up - Forward
- Scroll Down - Backward
- ]])
- while true do
- create_char()
- local fell = false
- if head and (workspace.FallenPartsDestroyHeight + 30) > head.Position.Y then
- fell = true
- head.Position = Vector3.new(head.Position.X,10,head.Position.Z)
- end
- if head and not fell then
- head.Anchored = true
- head.CanCollide = false
- head.Massless = false
- moveto(lpos,0.5)
- end
- Swait()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement