Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- repeat wait() until game.Workspace:FindFirstChild(game.Players.LocalPlayer.Name)
- --Set up--
- ip = game:GetService("UserInputService")
- --game.Players.LocalPlayer.Character:Destroy()
- msense = 7
- zoomMax = 85
- speed = 1.5
- ks = {}
- PLRuse_External_Model = true
- ext_md_Dir = game.ReplicatedStorage.plr
- cam = game.Workspace.CurrentCamera
- Mouse = game.Players.LocalPlayer:GetMouse()
- --Spawn Player--
- function plrSpn()
- if PLRuse_External_Model == false then
- --parts--
- plr = Instance.new("Model",game.Workspace)
- plr.Name = "Plr"
- local core = Instance.new("Part",plr)
- core.Name = "Core"
- core.FormFactor = "Custom"
- core.Size = Vector3.new(1,2,2)
- core.BottomSurface = "Smooth"
- core.TopSurface = "Smooth"
- core.Anchored = false
- core.CanCollide = true
- core.Position = Vector3.new(0,50,0)
- local bg = Instance.new("BodyGyro",plr.Core)
- local bf = Instance.new("BodyForce",plr.Core)
- bf.force = Vector3.new(0,50,0)
- --welds--
- --positions--
- elseif PLRuse_External_Model == true then
- plr = ext_md_Dir:clone()
- repeat wait() until game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
- for i, c in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
- if c.Name ~= "Head" and c.Name ~= "Torso" and c.Name ~= "HumanoidRootPart" and c.Name ~= "Humanoid" then
- if c:IsA("Part") or c:IsA("BasePart") or c:IsA("CharacterMesh") or c:IsA("ShirtGraphic") or c:IsA("Shirt") or c:IsA("Pants") or c:IsA("Hat") or c:IsA("BodyColors") or c:IsA("Script") or c:IsA("LocalScript") then c:Destroy() end
- plr.Parent = game.Players.LocalPlayer.Character
- end
- end
- plr.Parent = game.Players.LocalPlayer.Character
- game.Players.LocalPlayer.Character.Torso.CanCollide = false
- game.Players.LocalPlayer.Character.Head.CanCollide = false
- game.Players.LocalPlayer.Character.HumanoidRootPart.CanCollide = false
- game.Players.LocalPlayer.Character.Head:FindFirstChild("face"):Destroy()
- game.Players.LocalPlayer.Character.Torso.Transparency = 1
- game.Players.LocalPlayer.Character.Head.Transparency = 1
- hum = game.Players.LocalPlayer.Character.Humanoid
- hum.WalkSpeed = 40
- w = Instance.new("Weld",hum)
- w.Part0 = plr.Core
- w.Part1 = hum.Parent.HumanoidRootPart
- local bg = Instance.new("BodyGyro",plr.Core)
- local bf = Instance.new("BodyForce",plr.Core)
- bf.force = Vector3.new(0,-50,0)
- end
- end
- --Character controller--
- inp = coroutine.wrap(function()
- game:GetService("RunService").RenderStepped:connect(function()
- ip.InputBegan:connect(function(k,p)
- ks[k.KeyCode] = true
- end)
- ip.InputEnded:connect(function(k,p)
- ks[k.KeyCode] = false
- end)
- end)
- end)
- plrCnt = coroutine.wrap(function()
- game:GetService("RunService").RenderStepped:connect(function()
- local direction = cam.CoordinateFrame.lookVector
- plr.Core.Velocity = Vector3.new(0,plr.Core.Velocity.y,0)
- if ks[Enum.KeyCode.W] and ks[Enum.KeyCode.A] then
- elseif ks[Enum.KeyCode.W] and ks[Enum.KeyCode.D] then
- elseif ks[Enum.KeyCode.S] and ks[Enum.KeyCode.A] then
- elseif ks[Enum.KeyCode.S] and ks[Enum.KeyCode.D] then
- elseif ks[Enum.KeyCode.W] then
- local test = Vector3.new(plr.Core.Position.x + direction.x*speed,plr.Core.Position.y,plr.Core.Position.z + direction.z*speed)
- plr:MoveTo(test)
- plr.Core.CFrame = CFrame.new(plr.Core.Position, plr.Core.Position+Vector3.new(direction.X,0,direction.Z))*CFrame.new(0,0.1,0)
- elseif ks[Enum.KeyCode.S] then
- local test = Vector3.new(plr.Core.Position.x + -direction.x*speed,plr.Core.Position.y,plr.Core.Position.z + -direction.z*speed)
- plr:MoveTo(test)
- plr.Core.CFrame = CFrame.new(plr.Core.Position, plr.Core.Position+Vector3.new(direction.X,0,direction.Z))*CFrame.new(0,0.1,0)
- elseif ks[Enum.KeyCode.A] then
- plr.Core.CFrame = CFrame.new(plr.Core.Position, plr.Core.Position+Vector3.new(direction.X,0,direction.Z))*CFrame.new(0,0.1,0)
- --plr.Core.Velocity = Vector3.new(direction.z*-speed,plr.Core.Velocity.y,direction.x*-speed)
- elseif ks[Enum.KeyCode.D] then
- plr.Core.CFrame = CFrame.new(plr.Core.Position, plr.Core.Position+Vector3.new(direction.X,0,direction.Z))*CFrame.new(0,0.1,0)
- --plr.Core.Velocity = Vector3.new(direction.z*speed,plr.Core.Velocity.y,direction.x*speed)
- end
- end)
- end)
- camCnt = coroutine.wrap(function()
- cam.CameraType = Enum.CameraType.Scriptable
- cam.CoordinateFrame = CFrame.new(plr.Core.Position+Vector3.new(0,20,60))
- wait(1)
- ip.MouseBehavior = Enum.MouseBehavior.LockCenter
- game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
- local angleX = 0
- local angleY = 0
- ip.InputChanged:connect(function(inputObject)
- if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
- if inputObject.Delta.x < 0 then
- angleX = angleX - 1 * msense
- elseif inputObject.Delta.x > 0 then
- angleX = angleX + 1 * msense
- end
- if inputObject.Delta.y < 0 then
- angleY = angleY - 1 * msense
- elseif inputObject.Delta.y > 0 then
- angleY = angleY + 1 * msense
- end
- end
- end)
- game:GetService("RunService").RenderStepped:connect(function()
- if angleY > zoomMax then
- angleY = zoomMax
- elseif angleY < -zoomMax then
- angleY = -zoomMax
- end
- local x = 5 * math.cos(math.rad(angleX))
- local z = 5 * math.sin(math.rad(angleX))
- local y = 2.5 * math.tan(math.rad(angleY))
- local camPosition = Vector3.new(x, y, z)
- camPosition = camPosition + plr.Core.Position
- cam.CoordinateFrame = CFrame.new(camPosition, plr.Core.Position)*CFrame.new(0,2,3)
- end)
- end)
- bounds = coroutine.wrap(function()
- game:GetService("RunService").RenderStepped:connect(function()
- if plr.Core.Position.Y < -50 then
- plr.Core.CFrame = CFrame.new(0,10,0)
- plr.Core.Velocity = Vector3.new(0,0,0)
- elseif plr.Core.Position.Y > 10000 then
- plr.Core.CFrame = CFrame.new(0,10,0)
- plr.Core.Velocity = Vector3.new(0,0,0)
- end
- end)
- end)
- wait(2)
- plrSpn()
- inp()
- plrCnt()
- camCnt()
- bounds()
Advertisement
Add Comment
Please, Sign In to add comment