Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 3/1/2019 free camera script by Valualty --
- -- twitter: @Valualty --
- SPEEDY_DRIFTY = 0.7 -- studs every 1/60 seconds
- x_degree = 1.2 -- degrees every 1/60 seconds
- y_degree = 0.8 -- degrees every 1/60 seconds
- plr = game.Players.LocalPlayer
- repeat
- wait()
- until plr.Character
- mouse = plr:GetMouse()
- cam = workspace.CurrentCamera
- hum = plr.Character.Humanoid
- oldspeed = hum.WalkSpeed
- run = game:GetService('RunService')
- screensize = cam.ViewportSize
- w,s,a,d,q,e = false,false,false,false,false,false -- position
- rr,rl,ru,rd = false,false,false,false -- rotation
- ded = false
- tog = true
- keydown = mouse.KeyDown:Connect(function(key)
- if key == 'w' then w = true end
- if key == 's' then s = true end
- if key == 'a' then a = true end
- if key == 'd' then d = true end
- if key == 'q' then q = true end
- if key == 'e' then e = true end
- if hum.Health > 0 then
- if key == string.lower('f') then
- if tog then
- tog = false
- else
- tog = true
- end
- end
- end
- end)
- keyup = mouse.KeyUp:Connect(function(key)
- if key == 'w' then w = false end
- if key == 's' then s = false end
- if key == 'a' then a = false end
- if key == 'd' then d = false end
- if key == 'q' then q = false end
- if key == 'e' then e = false end
- end)
- died = hum.Died:Connect(function()
- ded = true
- end)
- mousemove = mouse.Move:Connect(function()
- x = mouse.X
- y = mouse.Y
- if x / screensize.X <= 0.01 then
- rl = true
- else
- rl = false
- end
- if x / screensize.X >= 0.99 then
- rr = true
- else
- rr = false
- end
- if y / screensize.Y <= 0.05 then
- ru = true
- else
- ru = false
- end
- if y / screensize.Y >= 0.9 then
- rd = true
- else
- rd = false
- end
- end)
- while ded == false do
- if tog == true then
- cam.CameraType = 'Scriptable'
- hum.WalkSpeed = 0
- if w then
- cam.CFrame = cam.CFrame * CFrame.new(0,0,-SPEEDY_DRIFTY)
- end
- if s then
- cam.CFrame = cam.CFrame * CFrame.new(0,0,SPEEDY_DRIFTY)
- end
- if a then
- cam.CFrame = cam.CFrame * CFrame.new(-SPEEDY_DRIFTY,0,0)
- end
- if d then
- cam.CFrame = cam.CFrame * CFrame.new(SPEEDY_DRIFTY,0,0)
- end
- if q then
- cam.CFrame = cam.CFrame * CFrame.new(0,-SPEEDY_DRIFTY,0)
- end
- if e then
- cam.CFrame = cam.CFrame * CFrame.new(0,SPEEDY_DRIFTY,0)
- end
- -- WORKS IN FIRST TRY --
- -- rotating is in global --
- if rl then
- camrot = cam.CFrame - cam.CFrame.p
- cam.CFrame = CFrame.new(cam.CFrame.p) * CFrame.Angles(0, math.rad(x_degree), 0) * camrot
- end
- if rr then
- camrot = cam.CFrame - cam.CFrame.p
- cam.CFrame = CFrame.new(cam.CFrame.p) * CFrame.Angles(0, math.rad(-x_degree), 0) * camrot
- end
- -- rotating x can't be in global --
- if ru then
- cam.CFrame = cam.CFrame * CFrame.Angles(math.rad(y_degree), 0, 0)
- end
- if rd then
- cam.CFrame = cam.CFrame * CFrame.Angles(math.rad(-y_degree), 0, 0)
- end
- else
- hum.WalkSpeed = oldspeed
- cam.CameraType = 'Custom'
- cam.CameraSubject = hum
- end
- run.RenderStepped:Wait()
- end
- keydown:Disconnect()
- keyup:Disconnect()
- died:Disconnect()
- mousemove:Disconnect()
- cam.CameraType = 'Custom'
- cam.CameraSubject = hum
Add Comment
Please, Sign In to add comment