View difference between Paste ID: DLhPGQJJ and RnEJN1tv
SHOW: | | - or go back to the newest paste.
1
--[[
2
                                         _                   
3
                                        | |                  
4
__   ___ __    __ _ _ __  _   ___      _| |__   ___ _ __ ___ 
5
\ \ / / '__|  / _` | '_ \| | | \ \ /\ / / '_ \ / _ \ '__/ _ \
6
 \ V /| |    | (_| | | | | |_| |\ V  V /| | | |  __/ | |  __/
7
  \_/ |_|     \__,_|_| |_|\__, | \_/\_/ |_| |_|\___|_|  \___|
8
                           __/ |
9
                          |___/ 
10
11
 _                 _            _                            
12
| |               | |          | |                           
13
| |__  _   _   ___| | _____  __| |                           
14
| '_ \| | | | / __| |/ / _ \/ _` |                           
15
| |_) | |_| | \__ \   <  __/ (_| |                           
16
|_.__/ \__, | |___/_|\_\___|\__,_|                           
17
        __/ |                                                
18
       |___/
19
	   
20
]]
21
22
local options = {}
23
24
-- OPTIONS:
25
26
options.headhat = "MediHood" -- name of the accessory which you are using as a head
27
options.headscale = 3 -- how big you are in vr, 1 is default, 3 is recommended for max comfort in vr
28
options.forcebubblechat = true -- decide if to force bubblechat so you can see peoples messages
29
30
options.righthandhat = "Pal Hair"
31
options.lefthandhat = "LavanderHair"
32
33
options.righthandrotoffset = Vector3.new(0,0,0)
34
options.lefthandrotoffset = Vector3.new(0,0,0)
35
36
--
37
38
local plr = game:GetService("Players").LocalPlayer
39
local char = plr.Character
40
local backpack = plr.Backpack
41
42
local VR = game:GetService("VRService")
43
local input = game:GetService("UserInputService")
44
45
local cam = workspace.CurrentCamera
46-
plr.MediHood.Handle.Mesh.MeshId = "rbxassetid://379552190"
46+
char.MediHood.Handle.Mesh.MeshId = "rbxassetid://379552190"
47-
plr.MediHood.Handle.Mesh.TextureId = "rbxassetid://379541232"
47+
char.MediHood.Handle.Mesh.TextureId = "rbxassetid://379541232"
48
cam.CameraType = "Scriptable"
49
50
cam.HeadScale = options.headscale
51
52
game:GetService("StarterGui"):SetCore("VRLaserPointerMode", 0)
53
game:GetService("StarterGui"):SetCore("VREnableControllerModels", false)
54
55
local handL
56
local handR
57
local head
58
local R1down = false
59
60
--local copy = game:GetObjects('rbxassetid://4469710589')[1]
61
--local copy = game:GetService("InsertService"):LoadAsset(4469710589):GetChildren()[1]
62
--local copy = game.ReplicatedStorage.Dummy:Clone()
63
64
local function loadhat(hat)
65
	local tool = Instance.new("Tool")
66
	local handle = hat.Handle
67
	
68
	handle:FindFirstChildOfClass("Weld"):Destroy()
69
	handle.Massless = true
70
	handle.Parent = tool
71
	
72
	tool.Name = hat.Name
73
	tool.Parent = backpack
74
	tool.Parent = char
75
	
76
	return tool
77
end
78
79
for i,v in pairs(char.Humanoid:GetAccessories()) do
80
	if v:FindFirstChild("Handle") then
81
		--local tool = Instance.new("Tool")
82
		--tool.Name = v.Name..i
83
		local handle = v.Handle
84
		
85
		if v.Name == options.righthandhat and not handR then
86
			handle:FindFirstChildOfClass("SpecialMesh"):Destroy()
87
			handR = loadhat(v)
88
		elseif v.Name == options.lefthandhat and not handL then
89
			handle:FindFirstChildOfClass("SpecialMesh"):Destroy()
90
			handL = loadhat(v)
91
		elseif v.Name == options.headhat and not head then
92
			handle.Transparency = 1
93
			head = loadhat(v)
94
		end
95
	end
96
end
97
98
--[[
99
local an = Instance.new("Animation",workspace)
100
an.AnimationId = "rbxassetid://31319431"
101
char.Humanoid:LoadAnimation(an):Play()
102
an:Remove()
103
]]
104
105
char.Humanoid.AnimationPlayed:connect(function(anim)
106
	anim:Stop()
107
end)
108
109
for i,v in pairs(char.Humanoid:GetPlayingAnimationTracks()) do
110
	v:AdjustSpeed(0)
111
end
112
113
local torso = char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso")
114
torso.Anchored = true
115
char.HumanoidRootPart.Anchored = true
116
117
--[[
118
local function move(tool,pos)
119
	local armcframe = char['Right Arm'].CFrame * CFrame.new(0, -1, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0)
120
	local cf = armcframe:toObjectSpace(pos):inverse()
121
	tool.Parent = backpack
122
	tool.Grip = cf
123
	tool.Parent = char
124
end
125
]]
126
127
--[[
128
copy.Parent = workspace
129
copy.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame
130
--game.Players.LocalPlayer.Character = copy
131
cam.CameraSubject = copy.Humanoid
132
copy.Humanoid.CameraOffset = Vector3.new(0, 5.4, 0)
133
]]
134
135
workspace.CurrentCamera.CFrame = CFrame.new(workspace.CurrentCamera.CFrame.Position)
136
137
input.UserCFrameChanged:connect(function(part,move)
138
	if part == Enum.UserCFrame.Head then
139
		--move(head,cam.CFrame*move)
140
		local rArm = char:FindFirstChild("Right Arm") or char:FindFirstChild("RightLowerArm")
141
		local armcframe = rArm.CFrame * CFrame.new(0, -1, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0)
142
		local cf = armcframe:toObjectSpace(cam.CFrame*(CFrame.new(move.p*(cam.HeadScale-1))*move)):inverse()
143
		head.Parent = backpack
144
		head.Grip = cf
145
		head.Parent = char
146
	elseif part == Enum.UserCFrame.LeftHand then
147
		--move(handL,cam.CFrame*move)
148
		local rArm = char:FindFirstChild("Right Arm") or char:FindFirstChild("RightLowerArm")
149
		local armcframe = rArm.CFrame * CFrame.new(0, -1, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0)
150
		local cf = armcframe:toObjectSpace(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)))):inverse()
151
		handL.Parent = backpack
152
		handL.Grip = cf
153
		handL.Parent = char
154
	elseif part == Enum.UserCFrame.RightHand then
155
		--move(handR,cam.CFrame*move)
156
		local rArm = char:FindFirstChild("Right Arm") or char:FindFirstChild("RightLowerArm")
157
		local armcframe = rArm.CFrame * CFrame.new(0, -1, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0)
158
		local cf = armcframe:toObjectSpace(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)))):inverse()
159
		handR.Parent = backpack
160
		handR.Grip = cf
161
		handR.Parent = char
162
	end
163
end)
164
165
input.InputChanged:connect(function(key)
166
	if key.KeyCode == Enum.KeyCode.ButtonR1 then
167
		if key.Position.Z > 0.9 then
168
			R1down = true
169
		else
170
			R1down = false
171
		end
172
	end
173
end)
174
175
input.InputBegan:connect(function(key)
176
	if key.KeyCode == Enum.KeyCode.ButtonR1 then
177
		R1down = true
178
	end
179
end)
180
181
input.InputEnded:connect(function(key)
182
	if key.KeyCode == Enum.KeyCode.ButtonR1 then
183
		R1down = false
184
	end
185
end)
186
187
game:GetService("RunService").RenderStepped:connect(function()
188
	if R1down then
189
		cam.CFrame = cam.CFrame:Lerp(cam.CoordinateFrame + (handR.Handle.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)
190
	end
191
end)
192
193
--[[
194
game:GetService("RunService").RenderStepped:connect(function(step)
195
	copy.Humanoid:MoveTo(copy.HumanoidRootPart.Position + char.Humanoid.MoveDirection * 6)
196
end)
197
]]
198
199
local function bubble(plr,msg)
200
	game:GetService("Chat"):Chat(plr.Character.Head,msg,Enum.ChatColor.White)
201
end
202
203
if options.forcebubblechat == true then
204
	game.Players.PlayerAdded:connect(function(plr)
205
		plr.Chatted:connect(function(msg)
206
			game:GetService("Chat"):Chat(plr.Character.Head,msg,Enum.ChatColor.White)
207
		end)
208
	end)
209
	
210
	for i,v in pairs(game.Players:GetPlayers()) do
211
		v.Chatted:connect(function(msg)
212
			game:GetService("Chat"):Chat(v.Character.Head,msg,Enum.ChatColor.White)
213
		end)
214
	end
215
end