Advertisement
bobopopcornboy

VrServer

Oct 12th, 2024 (edited)
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.48 KB | None | 0 0
  1. character = owner.Character
  2. object = nil
  3. if character:FindFirstChild("rightHand") then
  4.   character.leftHand:Destroy()
  5.   character.rightHand:Destroy()
  6.   --character.head:Destroy()
  7. end
  8. if workspace:FindFirstChild("vr") then
  9.   workspace.vr:Destroy()
  10. end
  11. local function createHand(handType)
  12.     local hand = Instance.new("Part")
  13.     hand.Parent = character
  14.     hand.CFrame = character.HumanoidRootPart.CFrame
  15.     --local we = Instance.new("WeldConstraint")
  16.     --we.Parent = character
  17.     --we.Part0 = character.HumanoidRootPart
  18.     --we.Part1 = hand
  19.     --we.Name = "vr"
  20.     hand.Size = Vector3.new(0.4, 0.4, 1)
  21.     hand.Transparency = 0
  22.     hand.Color = Color3.new(1, 0.72, 0.6)
  23.     hand.Material = Enum.Material.SmoothPlastic
  24.     hand.CanCollide = false
  25.     hand.Anchored = true
  26.     hand.Name = handType
  27.     return hand
  28. end
  29.  
  30. function destroyCharacter()
  31. character.LeftUpperArm:Destroy()
  32. character.RightUpperArm:Destroy()
  33. character.LeftUpperLeg:Destroy()
  34. character.RightUpperLeg:Destroy()
  35. character.LowerTorso:Destroy()
  36. character.UpperTorso.CanCollide = true
  37. character.UpperTorso.Transparency = 1
  38. end
  39.  
  40. local start = true
  41. local leftHand = createHand("rightHand")
  42. local rightHand = createHand("leftHand")
  43. head = character.Head --head = Instance.new("Part")
  44. head.Size = Vector3.new(0.4, 0.4, 0.4)
  45. head.Anchored = true
  46. rootpart = character.HumanoidRootPart
  47. rootpart.Anchored = true
  48. --head.Parent = character
  49. --head.CFrame = character.HumanoidRootPart.CFrame
  50. --head.Name = "head"
  51. head.CanCollide = false
  52. event = Instance.new("RemoteEvent")
  53. event.Name = "vr"
  54. event.Parent = workspace
  55. event.OnServerEvent:Connect(function(player,lhp,rhp,hp)
  56.   if player == owner then
  57.     if pho == "grab" then
  58.       object = rhp
  59.       if object.Anchored then object.Anchored = false end
  60.       if object and not object.Anchored then
  61.         object:SetNetworkOwnership(owner)
  62.         Bool = false
  63.                     if object:GetNetworkOwner() == owner then Bool = true end
  64.         event.FireClient(owner,"grab",Bool)
  65.       end
  66.     else
  67.     if start then
  68.       destroyCharacter()
  69.       start = false
  70.     end
  71.     leftHand.CFrame = lhp
  72.     rightHand.CFrame = rhp
  73.     head.CFrame = hp
  74.     rootpart.CFrame = hp
  75.     end
  76.   end
  77. end)
  78.  
  79.  
  80. --punching
  81. function punch(hit)
  82.   local hi = hit.Parent:FindFirstChild("Humanoid")
  83.   if hi then
  84.     local target = hit.Parent
  85.     target = target.PrimaryPart
  86.     target.Velocity = Vector3.new(9e7, 9e7 * 10, 9e7)
  87.     hi.Health = hi.Health - 5
  88.   end
  89. end
  90.  
  91. --rightHand.Touched:Connect()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement