Filipono120

ROBLOX Wiimote Script

Sep 21st, 2020
992
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.  
  3.          Name: Wiimote      
  4.         Category: Tools    
  5.      Aka: The wii controller
  6.  
  7. ]]
  8.  
  9. wait(1 / 60)
  10. print("\n Wiimote loaded! \n While using wii, you can move arms \n Controls: \n [E] - Wii 1 button \n [R] - Wii 2 button \n [Z] - Wii button \n [J, I, K, L] - D-pad buttons \n [P, O] - Start/Select buttons")
  11.  
  12. local plr = game.Players.LocalPlayer
  13. local character = plr.Character
  14. local mouse = plr:GetMouse()
  15. local head = character.Head
  16.  
  17. local Motor6D = {
  18.  
  19.     ["LeftShoulder"] = character.Torso["Left Shoulder"],
  20.     ["Neck"] = character.Torso.Neck,
  21.     ["RightShoulder"] = character.Torso["Right Shoulder"],
  22.     ["LeftHip"] = character.Torso["Left Hip"],
  23.     ["RightHip"] = character.Torso["Right Hip"],
  24.  
  25. }
  26.  
  27. local sound = Instance.new("Sound", head)
  28. sound.Name = "CurrentSound"
  29.  
  30. local equipped = false
  31.  
  32. local wiimote = Instance.new("Tool", plr.Backpack)
  33. wiimote.Name = "Wiimote"
  34.  
  35. local handle = Instance.new("Part", wiimote)
  36. handle.Name = "Handle"
  37. handle.Size = Vector3.new(0.45, 0.419, 1.85)
  38.  
  39. local mesh = Instance.new("SpecialMesh", handle)
  40. mesh.MeshType = Enum.MeshType.FileMesh
  41. mesh.MeshId = "rbxassetid://5027230424"
  42. mesh.TextureId = "rbxassetid://5027230482"
  43.  
  44. wiimote.Equipped:Connect(function()
  45.     equipped = true
  46.     while true do
  47.         if equipped == true then
  48.             wait()
  49.             Motor6D.RightShoulder.C0 = CFrame.new(1, 0.8, 0) * CFrame.Angles(mouse.Hit.lookVector.X + mouse.Origin.lookVector.X + math.rad(0), mouse.Hit.lookVector.Y + mouse.Origin.lookVector.Y + math.rad(90), mouse.Hit.lookVector.Z + mouse.Origin.lookVector.Z + math.rad(0))
  50.         else
  51.             break
  52.         end
  53.     end
  54. end)
  55. wiimote.Unequipped:Connect(function()
  56.     equipped = false
  57.     wait(.01)
  58.     Motor6D.RightShoulder.C0 = CFrame.new(0.993, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(90), math.rad(0))
  59.     Motor6D.LeftShoulder.C0 = CFrame.new(-0.993, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(-90), math.rad(0))
  60.     Motor6D.Neck.C1 = CFrame.new(0, -0.5, 0) * CFrame.Angles(math.rad(90), math.rad(180), math.rad(0))
  61.     Motor6D.RightHip.C0 = CFrame.new(1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(90), math.rad(0))
  62.     Motor6D.LeftHip.C0 = CFrame.new(-1, -1, 0) * CFrame.Angles(math.rad(0), math.rad(-90), math.rad(0))
  63. end)
  64.  
  65. mouse.KeyDown:Connect(function(key)
  66.         key = key:lower()
  67.         if equipped == true then
  68.             if key == "e" or key == "r" then
  69.                 sound.SoundId = "rbxassetid://4086020670"
  70.                 wait(.1)
  71.                 sound:Play()
  72.             elseif key == "z" then
  73.                 sound.SoundId = "rbxassetid://156785206"
  74.                 wait(.1)
  75.                 sound:Play()
  76.             if key == "j" or key == "i" or key == "k" or key == "l" then
  77.                 sound.SoundId = "rbxassetid://4086020670"
  78.                 wait(.1)
  79.                 sound:Play()
  80.             elseif key == "z" then
  81.                 sound.SoundId = "rbxassetid://156785206"
  82.                 wait(.1)
  83.                 sound:Play()
  84.             elseif key == "p" or key == "o" then
  85.                 sound.SoundId = "rbxassetid://156785206"
  86.                 wait(.1)
  87.                 sound:Play()
  88.             end
  89.         end
  90.     end
  91. end)
RAW Paste Data