MurderFries

vr house

Nov 26th, 2020 (edited)
689
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  3. local RealPlayer = Player
  4. do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end
  5.  
  6. model = Instance.new("Model",workspace)
  7. model.Name = "vrhouse"
  8.  
  9. function newP(cfX,cfY,cfZ,sX,sY,sZ,colorname,matname,transp)
  10.  
  11.     local newPI = Instance.new("Part",model)
  12.     newPI.Size = Vector3.new(sX,sY,sZ)
  13.     newPI.CFrame = CFrame.new(cfX,cfY,cfZ)
  14.     newPI.BrickColor = BrickColor.new(colorname)
  15.  
  16.     newPI.Transparency = transp
  17.  
  18.     if matname == "Brick" then
  19.         newPI.Material = Enum.Material.Brick
  20.     elseif matname == "Cobblestone" then
  21.         newPI.Material = Enum.Material.Cobblestone
  22.     elseif matname == "Concrete" then
  23.         newPI.Material = Enum.Material.Concrete
  24.     elseif matname == "Corroded metal" then
  25.         newPI.Material = Enum.Material.CorrodedMetal
  26.     elseif matname == "Diamond plate" then
  27.         newPI.Material = Enum.Material.DiamondPlate
  28.     elseif matname == "Fabric" then
  29.         newPI.Material = Enum.Material.Fabric
  30.     elseif matname == "Foil" then
  31.         newPI.Material = Enum.Material.Foil
  32.     elseif matname == "Forcefield" then
  33.         newPI.Material = Enum.Material.Forcefield
  34.     elseif matname == "Grass" then
  35.         newPI.Material = Enum.Material.Grass
  36.     elseif matname == "Glass" then
  37.         newPI.Material = Enum.Material.Glass
  38.     elseif matname == "Granite" then
  39.         newPI.Material = Enum.Material.Granite
  40.     elseif matname == "Ice" then
  41.         newPI.Material = Enum.Material.Ice
  42.     elseif matname == "Marble" then
  43.         newPI.Material = Enum.Material.Marble
  44.     elseif matname == "Metal" then
  45.         newPI.Material = Enu.Material.Metal
  46.     elseif matname == "Neon" then
  47.         newPI.Material = Enum.Material.Neon
  48.     elseif matname == "Pebble" then
  49.         newPI.Material = Enum.Material.Pebble
  50.     elseif matname == "Plastic" then
  51.         newPI.Material = Enum.Material.Plastic
  52.     elseif matname == "Sand" then
  53.         newPI.Material = Enum.Material.Sand
  54.     elseif matname == "Slate" then
  55.         newPI.Material = Enum.Material.Slate
  56.     elseif matname == "Wood planks" then
  57.         newPI.Material = Enum.Material.WoodPlanks
  58.     elseif matname == "Wood" then
  59.         newPI.Material = Enum.Material.Wood
  60.     elseif matname == "Smooth plastic" then
  61.         newPI.Material = Enum.Material.SmoothPlastic
  62.     else end
  63.  
  64.     newPI.TopSurface = Enum.SurfaceType.Smooth
  65.     newPI.BottomSurface = Enum.SurfaceType.Smooth
  66.  
  67.     newPI.Anchored = true
  68.  
  69. end
  70.  
  71. function adjustP(partdirectory,cfX,cfY,cfZ,sX,sY,sZ,colorname,matname,transp)
  72.  
  73.     local newPI = partdirectory
  74.     newPI.Size = Vector3.new(sX,sY,sZ)
  75.     newPI.CFrame = CFrame.new(cfX,cfY,cfZ)
  76.     newPI.BrickColor = BrickColor.new(colorname)
  77.  
  78.     newPI.Transparency = transp
  79.  
  80.     if matname == "Brick" then
  81.         newPI.Material = Enum.Material.Brick
  82.     elseif matname == "Cobblestone" then
  83.         newPI.Material = Enum.Material.Cobblestone
  84.     elseif matname == "Concrete" then
  85.         newPI.Material = Enum.Material.Concrete
  86.     elseif matname == "Corroded metal" then
  87.         newPI.Material = Enum.Material.CorrodedMetal
  88.     elseif matname == "Diamond plate" then
  89.         newPI.Material = Enum.Material.DiamondPlate
  90.     elseif matname == "Fabric" then
  91.         newPI.Material = Enum.Material.Fabric
  92.     elseif matname == "Foil" then
  93.         newPI.Material = Enum.Material.Foil
  94.     elseif matname == "Forcefield" then
  95.         newPI.Material = Enum.Material.Forcefield
  96.     elseif matname == "Grass" then
  97.         newPI.Material = Enum.Material.Grass
  98.     elseif matname == "Glass" then
  99.         newPI.Material = Enum.Material.Glass
  100.     elseif matname == "Granite" then
  101.         newPI.Material = Enum.Material.Granite
  102.     elseif matname == "Ice" then
  103.         newPI.Material = Enum.Material.Ice
  104.     elseif matname == "Marble" then
  105.         newPI.Material = Enum.Material.Marble
  106.     elseif matname == "Metal" then
  107.         newPI.Material = Enu.Material.Metal
  108.     elseif matname == "Neon" then
  109.         newPI.Material = Enum.Material.Neon
  110.     elseif matname == "Pebble" then
  111.         newPI.Material = Enum.Material.Pebble
  112.     elseif matname == "Plastic" then
  113.         newPI.Material = Enum.Material.Plastic
  114.     elseif matname == "Sand" then
  115.         newPI.Material = Enum.Material.Sand
  116.     elseif matname == "Slate" then
  117.         newPI.Material = Enum.Material.Slate
  118.     elseif matname == "Wood planks" then
  119.         newPI.Material = Enum.Material.WoodPlanks
  120.     elseif matname == "Wood" then
  121.         newPI.Material = Enum.Material.Wood
  122.     elseif matname == "Smooth plastic" then
  123.         newPI.Material = Enum.Material.SmoothPlastic
  124.     else end
  125.  
  126.     newPI.TopSurface = Enum.SurfaceType.Smooth
  127.     newPI.BottomSurface = Enum.SurfaceType.Smooth
  128.  
  129.     newPI.Anchored = true
  130.  
  131. end
  132.  
  133. newP(-47,.4,-11,16,1,16,"Mint","Fabric",0) --Floor
  134.  
  135. --Doorway and outside wall
  136. newP(-38.6,5.25,-16.25,.8,10.7,5.5,"Pastel brown","Wood",0)
  137. newP(-38.6,5.25,-5.75,.8,10.7,5.5,"Pastel brown","Wood",0)
  138. newP(-38.6,.4,-11,.8,1,5,"Pastel brown","Wood",0)
  139. newP(-38.6,9.15,-11,.8,2.9,5,"Pastel brown","Wood",0)
  140.  
  141. --Other outside walls
  142.  
  143. newP(-46.6,5.25,-2.6,16.8,10.7,.8,"Pastel brown","Wood",0)
  144. newP(-55.4,5.25,-11,.8,10.7,17.6,"Pastel brown","Wood",0)
  145.  
  146. --Window wall
  147.  
  148. newP(-46.6,1.95,-19.4,16.9,4.1,.8,"Pastel brown","Wood",0)
  149. newP(-41.6,5.75,-19.4,6.8,3.5,.8,"Pastel brown","Wood",0)
  150. newP(-53.6,5.75,-19.4,2.8,3.5,.8,"Pastel brown","Wood",0)
  151. newP(-46.6,9.05,-19.4,16.8,3.1,.8,"Pastel brown","Wood",0)
  152.  
  153. newP(-48.6,5.75,-19.35,7.2,3.5,.7,"Pastel light blue","Smooth plastic",.6)
  154.  
  155. --Roof (Might be removed and replaced with upper story later!)
  156.  
  157. newP(-47,11.05,-11,17.6,.9,17.6,"Pastel brown","Wood",0)
  158. newP(-47,10.55,-11,16,.1,16,"White","Smooth plastic",0)
  159.  
  160. --Interior walls
  161.  
  162. newP(-46.65,9.05,-18.95,16.7,3.1,.1,"Pastel green","Smooth plastic",0)
  163. newP(-41.65,5.75,-18.95,6.7,3.5,.1,"Pastel green","Smooth plastic",0)
  164. newP(-53.6,5.75,-18.95,2.8,3.5,.1,"Pastel green","Smooth plastic",0)
  165. newP(-46.65,1.95,-18.95,16.7,4.1,.1,"Pastel green","Smooth plastic",0)
  166.  
  167. newP(-54.95,5.25,-11,.1,10.7,17.4,"Pastel green","Smooth plastic",0)
  168.  
  169. newP(-46.6,5.25,-3.05,16.6,10.7,.1,"Pastel green","Smooth plastic",0)
  170.  
  171. newP(-39.05,5.25,-5.75,.1,10.8,5.5,"Pastel green","Smooth plastic",0)
  172. newP(-39.05,5.25,-16.25,.1,10.7,5.5,"Pastel green","Smooth plastic",0)
  173. newP(-39.05,9.15,-10.95,.1,3,5.1,"Pastel green","Smooth plastic",0)
  174.  
  175. --Bed
  176.  
  177. newP(-49.15,.95,-6.2,9.7,.3,4.6,"Maroon","Fabric",0)
  178. newP(-52.45,1.2,-6.2,2.3,.4,3.4,"White","Sand",0)
  179.  
  180. --Bin
  181.  
  182. newP(-43.86,2.6,-16.639,.2,3.4,3.7,"Ghost grey","Concrete",0)
  183. newP(-41.76,2.6,-14.889,4,3.4,.2,"Ghost grey","Concrete",0)
  184. newP(-39.66,2.6,-16.639,.2,3.4,3.7,"Ghost grey","Concrete",0)
  185. newP(-41.76,2.6,-18.389,4,3.4,.2,"Ghost grey","Concrete",0)
  186. newP(-41.76,1.05,-16.639,4,.3,3.3,"Ghost grey","Concrete",0)
  187.  
  188. --Bin contents
  189.  
  190. basketball = Instance.new("Part",model)
  191. adjustP(basketball,-40.5,1.7,-17.5,1.5,1.5,1.5,"Medium stone grey","Plastic",0)
  192. basketball.Shape = Enum.PartType.Ball
  193. basketball.Anchored = false
  194.  
  195. basketballM = Instance.new("SpecialMesh",basketball)
  196. basketballM.MeshType = "FileMesh"
  197. basketballM.MeshId = "rbxassetid://430345698"
  198. basketballM.TextureId = "rbxassetid://430345777"
  199. basketballM.Scale = Vector3.new(.06,.06,.06)
  200.  
  201.  
  202. basketball2 = Instance.new("Part",model)
  203. adjustP(basketball2,-40.5,3.3,-17.5,1.5,1.5,1.5,"Medium stone grey","Plastic",0)
  204. basketball2.Shape = Enum.PartType.Ball
  205. basketball2.Anchored = false
  206.  
  207. basketballM2 = Instance.new("SpecialMesh",basketball)
  208. basketballM2.MeshType = "FileMesh"
  209. basketballM2.MeshId = "rbxassetid://430345698"
  210. basketballM2.TextureId = "rbxassetid://430345777"
  211. basketballM2.Scale = Vector3.new(.06,.06,.06)
RAW Paste Data