Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --yes, i skidded this
- Key = "E"
- turnBody = false
- target = "Head"
- char = game.Players.LocalPlayer.Character
- camera = workspace.Camera
- part = nil
- enabled = false
- mouse = game.Players.LocalPlayer:GetMouse()
- function onKeyPress(actionName, State, inputObject)
- if State == Enum.UserInputState.Begin then
- if mouse.Target ~= nil and mouse.Target:FindFirstAncestorWhichIsA("Model"):FindFirstChild("Humanoid") then
- part = mouse.Target:FindFirstAncestorWhichIsA("Model")[target]
- enabled = true
- camera.CFrame = CFrame.new(Vector3.new(camera.CFrame.X, camera.CFrame.Y,camera.CFrame.Z),Vector3.new(part.CFrame.p.X,part.CFrame.p.Y,part.CFrame.p.Z) )
- if turnBody then
- char.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(char.HumanoidRootPart.CFrame.X,char.HumanoidRootPart.CFrame.Y,char.HumanoidRootPart.CFrame.Z), Vector3.new(part.CFrame.p.X,char.HumanoidRootPart.CFrame.p.Y,part.CFrame.p.Z))
- end
- else
- enabled = false
- end
- end
- if State == Enum.UserInputState.End then
- enabled = false
- end
- end
- game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode[Key])
- function cameraChanged()
- camera.Changed:Connect(function()
- if enabled then
- camera.CFrame = CFrame.new(Vector3.new(camera.CFrame.X, camera.CFrame.Y,camera.CFrame.Z),Vector3.new(part.CFrame.p.X,part.CFrame.p.Y,part.CFrame.p.Z) )
- if turnBody then
- char.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(char.HumanoidRootPart.CFrame.X,char.HumanoidRootPart.CFrame.Y,char.HumanoidRootPart.CFrame.Z), Vector3.new(part.CFrame.p.X,char.HumanoidRootPart.CFrame.p.Y,part.CFrame.p.Z))
- end
- end
- end)
- end
- spawn(cameraChanged)
- wait()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement