Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,Mouse,mouse,UserInputService,ContextActionService = owner
- local RealPlayer = Player
- 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
- -- start script --
- model = Instance.new("Model",workspace)
- model.Name = "MysteryBox"
- script.Parent = model
- --[[
- leftoverPart6 = workspace:FindFirstChild("really_long_name_for_mystery_box_part_6_that_no_one_will_ever_use_except_for_me")
- ]]--
- if leftoverPart6 then leftoverPart6:Destroy() end
- -- asset build --
- plr = game.Players.LocalPlayer
- char = plr.Character
- torso = char.Torso
- part1 = Instance.new("Part",model)
- part1.Size = Vector3.new(4.5,3,3)
- part1.CFrame = CFrame.new(torso.CFrame.X + 3,torso.CFrame.Y + 6,torso.CFrame.Z + 3)
- --[[physProp = PhysicalProperties.new(0.75, 20, 0.3, 1, 1)
- part1.CustomPhysicalProperties = physProp]]--
- part1.Massless = true
- p1x = part1.CFrame.X
- p1y = part1.CFrame.Y
- p1z = part1.CFrame.Z
- part2 = Instance.new("Part",model)
- part2.Size = Vector3.new(4.6,1,3.1)
- part2.CFrame = CFrame.new(p1x,p1y,p1z)
- part3 = Instance.new("Part",model)
- part3.Size = Vector3.new(4.8,1.2,1.2)
- part3.CFrame = CFrame.new(p1x,p1y,p1z)
- part4 = Instance.new("Part",model)
- part4.Size = Vector3.new(1.2,1.2,3.2)
- part4.CFrame = CFrame.new(p1x,p1y,p1z)
- part5 = Instance.new("Part",model)
- part5.Size = Vector3.new(4.8,3.3,3.3)
- part5.CFrame = CFrame.new(p1x,p1y,p1z)
- part5.Transparency = 1
- part6 = Instance.new("Part",model)
- part6.Size = Vector3.new(0.1,0.1,0.1)
- part6.CFrame = CFrame.new(p1x,p1y + 5,p1z)
- part6.Transparency = 1
- part6.Name = "really_long_name_for_mystery_box_part_6_that_no_one_will_ever_use_except_for_me"
- weld1 = Instance.new("Weld",model)
- weld1.Part0 = part1
- weld1.Part1 = part2
- weld2 = Instance.new("Weld",model)
- weld2.Part0 = part1
- weld2.Part1 = part3
- weld3 = Instance.new("Weld",model)
- weld3.Part0 = part1
- weld3.Part1 = part4
- weld4 = Instance.new("Weld",model)
- weld4.Part0 = part1
- weld4.Part1 = part5
- weld5 = Instance.new("Weld",model)
- weld5.Part0 = part1
- weld5.Part1 = part6
- part1.TopSurface = Enum.SurfaceType.Smooth
- part1.BottomSurface = Enum.SurfaceType.Smooth
- part2.TopSurface = Enum.SurfaceType.Smooth
- part2.BottomSurface = Enum.SurfaceType.Smooth
- part3.TopSurface = Enum.SurfaceType.Smooth
- part3.BottomSurface = Enum.SurfaceType.Smooth
- part4.TopSurface = Enum.SurfaceType.Smooth
- part4.BottomSurface = Enum.SurfaceType.Smooth
- part2.CanCollide = false
- part3.CanCollide = false
- part4.CanCollide = false
- part5.CanCollide = false
- part6.CanCollide = false
- part1.BrickColor = BrickColor.new("Shamrock")
- part2.BrickColor = BrickColor.new("Black")
- part3.BrickColor = BrickColor.new("New Yeller")
- part4.BrickColor = BrickColor.new("New Yeller")
- part1.Material = Enum.Material.Metal
- part2.Material = Enum.Material.Marble
- part3.Material = Enum.Material.Slate
- part4.Material = Enum.Material.Slate
- decal1 = Instance.new("Decal",part3)
- decal1.Texture = "rbxassetid://2276273"
- decal1.Face = Enum.NormalId.Left
- decal2 = Instance.new("Decal",part3)
- decal2.Texture = "rbxassetid://2276273"
- decal2.Face = Enum.NormalId.Right
- decal3 = Instance.new("Decal",part4)
- decal3.Texture = "rbxassetid://2276273"
- decal3.Face = Enum.NormalId.Back
- decal4 = Instance.new("Decal",part4)
- decal4.Texture = "rbxassetid://2276273"
- decal4.Face = Enum.NormalId.Front
- clickD = Instance.new("ClickDetector",part5)
- sound = Instance.new("Sound",part5)
- sound.SoundId = "rbxassetid://5049406383"
- sound.Volume = 2
- sound.Looped = false
- bGUI = Instance.new("BillboardGui",part6)
- bGUI.Enabled = false
- bGUI.MaxDistance = 30
- bGUI.Size = UDim2.new(0,200,0,500)
- tBox = Instance.new("TextBox",bGUI)
- tBox.BackgroundTransparency = 1
- tBox.TextScaled = true
- tBox.TextColor3 = Color3.new(255,255,255)
- tBox.TextStrokeColor3 = Color3.new(0,0,0)
- tBox.TextStrokeTransparency = 0
- tBox.Text = "Label"
- tBox.Position = UDim2.new(0,0,0,0)
- tBox.Size = UDim2.new(0,400,0,100)
- tBox.Font = Enum.Font.SourceSansItalic
- print("Box spawned at coordinates " ..p1x .. ", " .. p1y .. ", " .. p1z)
- -- extra builds / box outcome builds --
- -- function builds --
- local function setText(text)
- bGUI.Enabled = true
- tBox.Text = "You got "..text
- end
- local function Initialize()
- local rN = math.random(1,10)
- if rN == 1 then
- setText("Toad!")
- toadpart = Instance.new("Part",model)
- toadpart.Size = Vector3.new(3.81, 4.6, 3.312)
- toadpart.CFrame = CFrame.new(p1x,p1y + 5,p1z)
- toadmesh = Instance.new("SpecialMesh",toadpart)
- toadmesh.MeshType = Enum.MeshType.FileMesh
- toadmesh.TextureId = "rbxassetid://5038530309"
- toadmesh.MeshId = "rbxassetid://5038530279"
- toadmesh.Scale = Vector3.new(0.1, 0.1, 0.1)
- toadsound = Instance.new("Sound",toadpart)
- toadsound.SoundId = "rbxassetid://2497573478"
- toadsound.Volume = 2
- toadsound.Looped = false
- toadsound:Play()
- wait(6)
- toadsound:Stop()
- toadsound.SoundId = "rbxassetid://513492655"
- toadsound:Play()
- wait(1)
- toadexp = Instance.new("Explosion",toadpart)
- toadexp.BlastPressure = 0
- toadexp.BlastRadius = 0
- toadexp.DestroyJointRadiusPercent = 0
- toadexp.Position = Vector3.new(toadpart.CFrame.X,toadpart.CFrame.Y,toadpart.CFrame.Z)
- toadpart.Transparency = 1
- wait(3)
- toadsound:Stop()
- wait(2)
- toadpart:Destroy()
- elseif rN == 2 then
- setText("an arrest warrant!")
- fbisound = Instance.new("Sound",clickS.Character.Torso)
- fbisound.SoundId = "rbxassetid://4964334807"
- fbisound.Volume = 5
- fbisound.Looped = false
- fbisound:Play()
- wait(2)
- fbisound:Stop()
- fbisound.SoundId = "rbxassetid://158712406"
- fbisound:Play()
- wait(.75)
- clickS.Character:BreakJoints()
- elseif rN == 3 then
- script.Parent = clickS.Character
- setText("bloxy cola!")
- Tool = Instance.new("Tool",clickS.Character)
- Tool.GripForward = Vector3.new(-.976,0,-0.217)
- Tool.GripPos = Vector3.new(0.03,0,0)
- Tool.GripRight = Vector3.new(.217,0,-.976)
- Tool.GripUp = Vector3.new(0,1,0)
- colapart = Instance.new("Part",Tool)
- colapart.Size = Vector3.new(1, 1.2, 1)
- colapart.CFrame = CFrame.new(p1x,p1y + 4,p1z)
- colapart.Name = "Handle"
- Tool.Name = "Cola"
- Tool.TextureId = "http://www.roblox.com/asset/?id=10472127"
- colamesh = Instance.new("SpecialMesh",colapart)
- colamesh.MeshType = Enum.MeshType.FileMesh
- colamesh.TextureId = "rbxassetid://10470600"
- colamesh.MeshId = "rbxassetid://10470609"
- colamesh.Scale = Vector3.new(1.2, 1.2, 1.2)
- colaDrinkSound = Instance.new("Sound",colapart)
- colaDrinkSound.SoundId = "rbxassetid://10722059"
- colaDrinkSound.Volume = 1.25
- colaDrinkSound.Looped = false
- colaOpenSound = Instance.new("Sound",colapart)
- colaOpenSound.SoundId = "rbxassetid://10721950"
- colaOpenSound.Volume = 1.25
- colaOpenSound.Looped = false
- enabled = true
- enabled2 = false
- function onActivated()
- if not enabled then
- return
- end
- enabled = false
- Tool.GripForward = Vector3.new(0,-.759,-.651)
- Tool.GripPos = Vector3.new(1.5,-.5,.3)
- Tool.GripRight = Vector3.new(1,0,0)
- Tool.GripUp = Vector3.new(0,.651,-.759)
- colaDrinkSound:Play()
- wait(3)
- local h = Tool.Parent:FindFirstChild("Humanoid")
- if (h ~= nil) then
- if (h.MaxHealth > h.Health + 5) then
- h.Health = h.Health + 5
- else
- h.Health = h.MaxHealth
- end
- end
- Tool.GripForward = Vector3.new(-.976,0,-0.217)
- Tool.GripPos = Vector3.new(0.03,0,0)
- Tool.GripRight = Vector3.new(.217,0,-.976)
- Tool.GripUp = Vector3.new(0,1,0)
- enabled = true
- end
- function onEquipped()
- Tool.Handle.OpenSound:play()
- end
- function onEquipped()
- if enabled2 == false then
- clickS.Character.Humanoid:UnequipTools()
- enabled2 = true
- print("enabled2 was false for cola")
- else
- colaOpenSound:play()
- end
- end
- clickS.Character.Humanoid:UnequipTools()
- Tool.Activated:connect(onActivated)
- Tool.Equipped:connect(onEquipped)
- elseif rN == 4 then
- setText("gnomed!")
- gnomepart = Instance.new("Part",model)
- gnomepart.Size = Vector3.new(4.5,7.5,0.05)
- gnomepart.CFrame = CFrame.new(p1x,p1y - 2.5,p1z)
- gnomepart.Anchored = true
- gnomepart.CanCollide = false
- gnomepart.Transparency = 1
- gnomedecal1 = Instance.new("Decal",gnomepart)
- gnomedecal1.Texture = "rbxassetid://5197525736"
- gnomedecal1.Face = Enum.NormalId.Front
- gnomedecal2 = Instance.new("Decal",gnomepart)
- gnomedecal2.Texture = "rbxassetid://5197525736"
- gnomedecal2.Face = Enum.NormalId.Back
- gnomesound = Instance.new("Sound",gnomepart)
- gnomesound.SoundId = "rbxassetid://2521946636"
- gnomesound.Volume = 1.25
- gnomesound.Looped = false
- gnomesound.PlaybackSpeed = 1.5
- gnomesound:Play()
- wait(10.2)
- gnomepart:Destroy()
- elseif rN == 5 then
- setText("some sick moves! Show them off!")
- dancesoundleftover = clickS.Character:FindFirstChild("mystery_box_dance_sound")
- if dancesoundleftover then dancesoundleftover:Destroy() end
- anim = Instance.new("Animation",clickS.Character)
- local dancesoundids = {
- 4708502893,
- 227479020,
- 297343361,
- 753096775,
- 2298566537,
- 525565668,
- 1386299751
- }
- anim.AnimationId = "rbxassetid://27789359"
- anim2 = clickS.Character.Humanoid:LoadAnimation(clickS.Character:FindFirstChildOfClass("Animation"))
- anim2.Looped = true
- anim2:Play()
- dancesound = Instance.new("Sound",clickS.Character.Torso)
- dancesound.SoundId = "rbxassetid://" ..dancesoundids[math.random(#dancesoundids)]
- dancesound.Volume = 0.7
- dancesound.Looped = true
- dancesound.name = "mystery_box_dance_sound"
- dancesound:Play()
- elseif rN == 6 then
- setText("a pet Brock!")
- cSx = clickS.Character.Torso.CFrame.X
- cSy = clickS.Character.Torso.CFrame.Y
- cSz = clickS.Character.Torso.CFrame.Z
- brockpart = Instance.new("Part",clickS.Character)
- brockpart.Size = Vector3.new(2, 2, 2)
- brockpart.CFrame = CFrame.new(cSz,cSy,cSz)
- brockpart.Massless = true
- brockmesh = Instance.new("SpecialMesh",brockpart)
- brockmesh.MeshType = Enum.MeshType.FileMesh
- brockmesh.TextureId = "rbxassetid://21629620"
- brockmesh.MeshId = "rbxassetid://21629626"
- brockmesh.Scale = Vector3.new(1.6, 1.6, 1.6)
- brockmesh.Offset = Vector3.new(-2,-2,3)
- brockpart.CanCollide = false
- brockweld = Instance.new("Weld",clickS.Character)
- brockweld.Part0 = clickS.Character.Torso
- brockweld.Part1 = brockpart
- brocksound = Instance.new("Sound",brockpart)
- brocksound.SoundId = "rbxassetid://3123007321"
- brocksound.Volume = 2.5
- brocksound.Looped = false
- brocksound:Play()
- elseif rN == 7 then
- setText("TRIGGERED. It's okay, we have a plan for you!")
- if clickS.Character:FindFirstChildOfClass("Shirt") then
- clickS.Character:FindFirstChildOfClass("Shirt").ShirtTemplate = "rbxassetid://5360950775"
- else
- Instance.new("Shirt",clickS.Character)
- clickS.Character:FindFirstChildOfClass("Shirt").ShirtTemplate = "rbxassetid://5360950775"
- end
- if clickS.Character:FindFirstChildOfClass("Pants") then
- clickS.Character:FindFirstChildOfClass("Pants").PantsTemplate = "rbxassetid://5360995343"
- else
- Instance.new("Pants",clickS.Character)
- clickS.Character:FindFirstChildOfClass("Pants").PantsTemplate = "rbxassetid://5360995343"
- end
- trface = clickS.Character.Head:FindFirstChildOfClass("Decal")
- if trface then
- trface.Texture = "rbxassetid://168024772"
- end
- trsound = Instance.new("Sound",clickS.character.Torso)
- trsound.SoundId = "rbxassetid://3312970549"
- trsound.Volume = 3
- trsound.Looped = false
- trsound2 = Instance.new("Sound",clickS.character.Torso)
- trsound2.SoundId = "rbxassetid://1080089636"
- trsound2.Volume = 0.25
- trsound2.Looped = true
- trsound:Play()
- wait(4)
- trsound:Stop()
- trsound2:Play()
- elseif rN == 8 then
- setText("your health doubled!")
- dhhum = clickS.Character:FindFirstChildOfClass("Humanoid")
- dhhum.MaxHealth = dhhum.MaxHealth * 2
- dhhum.Health = dhhum.Health * 2 - 1
- --[[dheffect = Instance.new("ParticleEmitter",clickS.Character.Torso)
- dheffect.Transparency = NumberSequence.new(0.7,0.7)
- dheffect.Size = NumberSequence.new(0.25,0.25)
- dheffect.Texture = "rbxassetid://195459249"
- --dheffect.Texture = "rbxasset://textures/particles/sparkles_main.dds"
- dheffect.Lifetime = NumberRange.new(0.5,1)
- dheffect.Rate = NumberSequence.new(30,30)
- dheffect.Speed = NumberRange.new(5,5)
- dheffect.SpreadAngle = Vector2.new(-20,20)
- dheffect.EmissionDirection = Enum.NormalId.Top
- dheffect.ZOffset = 0
- dheffect.RotSpeed = NumberRange.new(0,0)
- dheffect.Rotation = NumberRange.new(0,0)
- dheffect.Acceleration = Vector3.new(0,0,0)
- dheffect.Enabled = true]]--
- dhsound = Instance.new("Sound",clickS.Character.Torso)
- dhsound.SoundId = "rbxassetid://1582829611"
- dhsound.Volume = 1.5
- dhsound.Looped = false
- dhsound:Play()
- --dheffect.Enabled = false
- elseif rN == 9 then
- setText("a comically large spoon!")
- script.Parent = clickS.Character
- Tool2 = Instance.new("Tool",clickS.Character)
- Tool2.GripForward = Vector3.new(0, -1, 0)
- Tool2.GripPos = Vector3.new(0, 0, 0.5)
- Tool2.GripRight = Vector3.new(1, 0, 0)
- Tool2.GripUp = Vector3.new(0, 0, -1)
- sppart = Instance.new("Part",Tool2)
- sppart.Size = Vector3.new(1.4, 0.75, 6.3)
- sppart.CFrame = CFrame.new(p1x,p1y + 4,p1z)
- sppart.Name = "Handle"
- Tool2.Name = "Comically Large Spoon"
- enabled2_2 = false
- spmesh = Instance.new("SpecialMesh",sppart)
- spmesh.MeshType = Enum.MeshType.FileMesh
- spmesh.TextureId = "rbxassetid://2037260269"
- spmesh.MeshId = "rbxassetid://431329906"
- spmesh.Scale = Vector3.new(3, 3, 3)
- spOpenSound = Instance.new("Sound",sppart)
- spOpenSound.SoundId = "rbxassetid://5178876770"
- spOpenSound.Volume = 3.5
- spOpenSound.Looped = false
- function onEquipped()
- if enabled2_2 == false then
- clickS.Character.Humanoid:UnequipTools()
- enabled2_2 = true
- print("enabled2 was false for spoon")
- else
- spOpenSound:play()
- end
- end
- clickS.Character.Humanoid:UnequipTools()
- Tool2.Equipped:connect(onEquipped)
- else
- setText("absolutely nothing!")
- end
- wait(2)
- part6:Destroy()
- end
- local function destroyDetails()
- part2:Destroy()
- part3:Destroy()
- part4:Destroy()
- end
- local function onClick(clickS2)
- clickD:Destroy()
- sound:Play()
- clickS = clickS2
- bGUI.Enabled = true
- tBox.Text = "Opening..."
- wait(.85)
- print("Box was opened by ".. clickS.Name .. ".")
- sound:Stop()
- part1.Anchored = true
- part1.CanCollide = false
- part1.Transparency = 1
- destroyDetails()
- p1x = part1.CFrame.X
- p1y = part1.CFrame.Y
- p1z = part1.CFrame.Z
- Initialize()
- part1:Destroy()
- part5:Destroy()
- end
- -- wrap up functions --
- clickD.MouseClick:Connect(onClick)
- -- end script --
RAW Paste Data