Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://github.com/Mokiros/roblox-FE-compatibility
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Tool0 = Instance.new("Tool")
- LocalScript1 = Instance.new("LocalScript")
- LocalScript2 = Instance.new("LocalScript")
- Part3 = Instance.new("Part")
- CylinderMesh4 = Instance.new("CylinderMesh")
- Part5 = Instance.new("Part")
- CylinderMesh6 = Instance.new("CylinderMesh")
- Part7 = Instance.new("Part")
- CylinderMesh8 = Instance.new("CylinderMesh")
- Model9 = Instance.new("Model")
- Script10 = Instance.new("Script")
- Model11 = Instance.new("Model")
- MeshPart12 = Instance.new("MeshPart")
- MeshPart13 = Instance.new("MeshPart")
- MeshPart14 = Instance.new("MeshPart")
- MeshPart15 = Instance.new("MeshPart")
- MeshPart16 = Instance.new("MeshPart")
- MeshPart17 = Instance.new("MeshPart")
- MeshPart18 = Instance.new("MeshPart")
- MeshPart19 = Instance.new("MeshPart")
- MeshPart20 = Instance.new("MeshPart")
- MeshPart21 = Instance.new("MeshPart")
- MeshPart22 = Instance.new("MeshPart")
- MeshPart23 = Instance.new("MeshPart")
- MeshPart24 = Instance.new("MeshPart")
- MeshPart25 = Instance.new("MeshPart")
- MeshPart26 = Instance.new("MeshPart")
- MeshPart27 = Instance.new("MeshPart")
- Script28 = Instance.new("Script")
- Tool0.Name = "Flag"
- Tool0.Parent = mas
- LocalScript1.Name = "BackupWeld"
- LocalScript1.Parent = Tool0
- table.insert(cors,sandbox(LocalScript1,function()
- function Weld(x,y)
- local W = Instance.new("Weld")
- W.Part0 = x
- W.Part1 = y
- local CJ = CFrame.new(x.Position)
- local C0 = x.CFrame:inverse()*CJ
- local C1 = y.CFrame:inverse()*CJ
- W.C0 = C0
- W.C1 = C1
- W.Parent = x
- end
- function Get(A)
- if A.className == "Part" then
- Weld(script.Parent.Handle, A)
- A.Anchored = false
- else
- local C = A:GetChildren()
- for i=1, #C do
- Get(C[i])
- end
- end
- end
- function Finale()
- Get(script.Parent)
- end
- script.Parent.Equipped:connect(Finale)
- script.Parent.Unequipped:connect(Finale)
- Finale()
- end))
- LocalScript2.Name = "FlagScript"
- LocalScript2.Parent = Tool0
- table.insert(cors,sandbox(LocalScript2,function()
- wait(.2)
- allStep=1/12
- local tool=script.Parent
- local weld33 = nil -- right arm
- local weld55 = nil
- local weld77 = nil
- local player = game.Players.LocalPlayer;
- local welds = {}
- local arms = nil
- local torso = nil
- local walk=false
- local twLs=0
- local twRs=0
- local twFs=0
- local cs=0
- function tweenLeft(left)
- step=allStep
- local tweenfunction = function ()
- local oldPos = weld55.C1.p
- local oldAngle = Vector3.new(weld55.C1:toEulerAnglesXYZ())
- local newPos = left.p
- local newAngle = Vector3.new(left:toEulerAnglesXYZ())
- local twLs=cs
- local Loop = coroutine.create(function()
- for i = 0, 1, step do
- wait()
- if twLs~=cs then
- break
- end
- weld55.C1 = CFrame.new((oldPos*(1-i))+(newPos*i))*CFrame.fromEulerAnglesXYZ((oldAngle.x*(1-i))+(newAngle.x*i),(oldAngle.y*(1-i))+(newAngle.y*i),(oldAngle.z*(1-i))+(newAngle.z*i))
- end
- end)
- coroutine.resume(Loop)
- end
- delay(0,tweenfunction)
- end
- function tweenRight(left)
- step=allStep
- local tweenfunction = function ()
- local oldPos = weld33.C1.p
- local oldAngle = Vector3.new(weld33.C1:toEulerAnglesXYZ())
- local newPos = left.p
- local newAngle = Vector3.new(left:toEulerAnglesXYZ())
- local twRs=cs
- local Loop = coroutine.create(function()
- for i = 0, 1, step do
- wait()
- if twRs~=cs then
- break
- end
- weld33.C1 = CFrame.new((oldPos*(1-i))+(newPos*i))*CFrame.fromEulerAnglesXYZ((oldAngle.x*(1-i))+(newAngle.x*i),(oldAngle.y*(1-i))+(newAngle.y*i),(oldAngle.z*(1-i))+(newAngle.z*i))
- end
- end)
- coroutine.resume(Loop)
- end
- delay(0,tweenfunction)
- end
- function tweenFlag(left)
- step=allStep
- local tweenfunction = function ()
- local oldPos = weld77.C1.p
- local oldPos = Vector3.new(oldPos.x,oldPos.y,oldPos.z)
- local oldAngle = Vector3.new(weld77.C1:toEulerAnglesXYZ())
- local newPos = left.p
- local newAngle = Vector3.new(left:toEulerAnglesXYZ())
- local twFs=cs
- local Loop = coroutine.create(function()
- for i = 0, 1, step do
- if twFs~=cs then
- break
- end
- wait()
- weld77.C1 = CFrame.new((oldPos*(1-i))+(newPos*i))*CFrame.fromEulerAnglesXYZ((oldAngle.x*(1-i))+(newAngle.x*i),(oldAngle.y*(1-i))+(newAngle.y*i),(oldAngle.z*(1-i))+(newAngle.z*i))
- end
- end)
- coroutine.resume(Loop)
- end
- delay(0,tweenfunction)
- end
- function f(a,b,c,d,e,f)
- return (CFrame.new(a,b,c)*CFrame.Angles(math.rad(d),math.rad(e),math.rad(f))):inverse()
- end
- function moved(d)
- if d>0 then
- if walk==false then
- walk=true
- cs=cs+1
- tweenLeft(f(-0.93,0.75,-1.02,120,37,50))
- tweenRight(f(1.04,0.15,-0.49,81,5,-44))
- tweenFlag(f(0.04,3.16,-1.52,-10,-90,0))
- end
- else
- if walk==true then
- walk=false
- cs=cs+1
- tweenLeft(f(-1.12,0.3,-0.84,75,-4,15))
- tweenRight(f(0.1,0.17,-1.14,72,2,-52))
- tweenFlag(f(-0.76,1.93,-1.73,5,-90,0))
- end
- end
- end
- function onEquippedLocal(mouse)
- if mouse == nil then
- return
- end
- player.Character.Humanoid.Running:connect(moved)
- -- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- while true do
- wait()
- end
- end
- function onUnequippedLocal(mouse)
- end
- function Equip(mouse)
- wait(0.01)
- tool.GripPos=Vector3.new(0,0,0)
- arms = {tool.Parent:FindFirstChild("Left Arm"), tool.Parent:FindFirstChild("Right Arm")}
- torso = tool.Parent:FindFirstChild("Torso")
- if arms ~= nil and torso ~= nil then
- local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
- if sh ~= nil then
- local yes = true
- if yes then
- yes = false
- sh[1].Part1 = nil
- sh[2].Part1 = nil
- local weld1 = Instance.new("Weld") -- left arm
- weld55 = weld1
- weld1.Part0 = torso
- weld1.Parent = torso
- weld1.Part1 = arms[1]
- weld1.C1 = f(-1.12,0.3,-0.84,75,-4,15)
- welds[1] = weld1
- local weld2 = Instance.new("Weld") -- right arm
- weld33 = weld2
- weld2.Part0 = torso
- weld2.Parent = torso
- weld2.Part1 = arms[2]
- weld2.C1 = f(0.1,0.17,-1.14,72,2,-52)
- welds[2] = weld2
- local weld3 = Instance.new("Weld") -- right arm
- weld77 = weld3
- weld3.Part0 = torso
- weld3.Parent = torso
- weld3.Part1 = tool.Handle
- weld3.C1 = f(-0.76,1.93,-1.73,5,-90,0)
- welds[3] = weld2
- end
- else
- end
- else
- end
- end
- function Unequip(mouse)
- if arms ~= nil and torso ~= nil then
- local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
- if sh ~= nil then
- local yes = true
- if yes then
- yes = false
- sh[1].Part1 = arms[1]
- sh[2].Part1 = arms[2]
- welds[1].Parent = nil
- welds[2].Parent = nil
- end
- else
- end
- else
- end
- end
- tool.Unequipped:connect(onUnequippedLocal)
- tool.Equipped:connect(onEquippedLocal)
- tool.Equipped:connect(Equip)
- tool.Unequipped:connect(Unequip)
- end))
- Part3.Name = "Handle"
- Part3.Parent = Tool0
- Part3.CFrame = CFrame.new(-11.6699781, 5.14999819, 7.60995817, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part3.Position = Vector3.new(-11.6699781, 5.14999819, 7.60995817)
- Part3.Color = Color3.new(0.486275, 0.360784, 0.27451)
- Part3.Size = Vector3.new(0.300000012, 10.3000002, 0.300000012)
- Part3.Anchored = true
- Part3.BackSurface = Enum.SurfaceType.SmoothNoOutlines
- Part3.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
- Part3.BrickColor = BrickColor.new("Brown")
- Part3.CanCollide = false
- Part3.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
- Part3.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
- Part3.Material = Enum.Material.Wood
- Part3.RightSurface = Enum.SurfaceType.SmoothNoOutlines
- Part3.TopSurface = Enum.SurfaceType.SmoothNoOutlines
- Part3.brickColor = BrickColor.new("Brown")
- Part3.FormFactor = Enum.FormFactor.Custom
- Part3.formFactor = Enum.FormFactor.Custom
- CylinderMesh4.Parent = Part3
- Part5.Name = "PoleCap"
- Part5.Parent = Tool0
- Part5.CFrame = CFrame.new(-11.6699781, 12.6498041, 7.60995817, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part5.Position = Vector3.new(-11.6699781, 12.6498041, 7.60995817)
- Part5.Color = Color3.new(0.992157, 0.917647, 0.552941)
- Part5.Size = Vector3.new(0.400000006, 0.300000191, 0.400000006)
- Part5.Anchored = true
- Part5.BackSurface = Enum.SurfaceType.SmoothNoOutlines
- Part5.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
- Part5.BrickColor = BrickColor.new("Cool yellow")
- Part5.CanCollide = false
- Part5.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
- Part5.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
- Part5.Material = Enum.Material.Metal
- Part5.RightSurface = Enum.SurfaceType.SmoothNoOutlines
- Part5.TopSurface = Enum.SurfaceType.SmoothNoOutlines
- Part5.brickColor = BrickColor.new("Cool yellow")
- Part5.FormFactor = Enum.FormFactor.Custom
- Part5.formFactor = Enum.FormFactor.Custom
- CylinderMesh6.Parent = Part5
- Part7.Name = "FabricPole"
- Part7.Parent = Tool0
- Part7.CFrame = CFrame.new(-11.6699781, 10.069582, 7.60995817, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part7.Position = Vector3.new(-11.6699781, 10.069582, 7.60995817)
- Part7.Size = Vector3.new(0.310000002, 4.85999727, 0.310000002)
- Part7.Anchored = true
- Part7.BackSurface = Enum.SurfaceType.SmoothNoOutlines
- Part7.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
- Part7.CanCollide = false
- Part7.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
- Part7.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
- Part7.Material = Enum.Material.Fabric
- Part7.RightSurface = Enum.SurfaceType.SmoothNoOutlines
- Part7.TopSurface = Enum.SurfaceType.SmoothNoOutlines
- Part7.FormFactor = Enum.FormFactor.Custom
- Part7.formFactor = Enum.FormFactor.Custom
- CylinderMesh8.Parent = Part7
- Model9.Name = "AnimatedFlag"
- Model9.Parent = Tool0
- Script10.Name = "Animate"
- Script10.Parent = Model9
- table.insert(cors,sandbox(Script10,function()
- --Sinahi
- --[[ReadMe*
- Please improve upon this script as needed, I'm a noob scripter and I only script
- through ways I know that work. This loop works, so I'm happy with it. But please,
- edit as you may.
- This model uses MeshParts to animate the flag. The previous frame turns transparent
- while the next frame becomes visible.
- If you would like to use your own custom flag, for your ROBLOX group or country,
- select all the children in the "Flag" model and paste in a ROBLOX decal asset in
- the "TextureID" slot. If you receive an error, try subtracting 1 from the decal id.
- http://www.roblox.com/asset/?id={decal id}
- rbxassetid://{decal id}
- Any ROBLOX decal in the Developers Library will work, or you may upload your own
- flag decal to insert in. Rectangular decals are recommended for this flag.
- *If you use a decal with a transparent background in the MeshPart's TextureID,
- the transparent background will default to black. Instead, insert the actual
- decal into every MeshPart in "Flag." This will allow you to change the BrickColor
- of the flag with the decal on top.
- The flags have been UV mapped to flip the flag design on the other side.
- e.g. You won't see the blue box of the United States flag on the other side
- of the flag on its end, but close to the pole for both sides.
- Thank you and have a wonderful day.
- (MeshParts rendered using Blender)
- --]]
- sp=script.Parent
- flag=sp.Flag
- reset=function()
- for _,meshpart in pairs (flag:GetChildren()) do
- if meshpart:IsA("MeshPart") then
- meshpart.Transparency=1
- end
- end
- end
- waittime=.04 --Time between each "Frame"
- while true do
- wait(waittime)
- reset()
- flag["2"].Transparency=0
- wait(waittime)
- reset()
- flag["3"].Transparency=0
- wait(waittime)
- reset()
- flag["4"].Transparency=0
- wait(waittime)
- reset()
- flag["5"].Transparency=0
- wait(waittime)
- reset()
- flag["6"].Transparency=0
- wait(waittime)
- reset()
- flag["7"].Transparency=0
- wait(waittime)
- reset()
- flag["8"].Transparency=0
- wait(waittime)
- reset()
- flag["9"].Transparency=0
- wait(waittime)
- reset()
- flag["10"].Transparency=0
- wait(waittime)
- reset()
- flag["11"].Transparency=0
- wait(waittime)
- reset()
- flag["12"].Transparency=0
- wait(waittime)
- reset()
- flag["13"].Transparency=0
- wait(waittime)
- reset()
- flag["14"].Transparency=0
- wait(waittime)
- reset()
- flag["15"].Transparency=0
- wait(waittime)
- reset()
- flag["16"].Transparency=0
- wait(waittime)
- reset()
- flag["1"].Transparency=0
- end
- end))
- Model11.Name = "Flag"
- Model11.Parent = Model9
- MeshPart12.Name = "16"
- MeshPart12.Parent = Model11
- MeshPart12.CFrame = CFrame.new(-7.548563, 10.0700817, 7.95722198, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
- MeshPart12.Orientation = Vector3.new(0, -8.67000008, 0)
- MeshPart12.Position = Vector3.new(-7.548563, 10.0700817, 7.95722198)
- MeshPart12.Rotation = Vector3.new(0, -8.67000008, 0)
- MeshPart12.Transparency = 1
- MeshPart12.Size = Vector3.new(8.03175545, 4.87044287, 0.647605479)
- MeshPart12.Anchored = true
- MeshPart12.CanCollide = false
- MeshPart12.Material = Enum.Material.Fabric
- MeshPart12.TextureID = "rbxassetid://12680129"
- MeshPart13.Name = "15"
- MeshPart13.Parent = Model11
- MeshPart13.CFrame = CFrame.new(-7.54236603, 10.0700817, 7.92471695, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
- MeshPart13.Orientation = Vector3.new(0, -8.67000008, 0)
- MeshPart13.Position = Vector3.new(-7.54236603, 10.0700817, 7.92471695)
- MeshPart13.Rotation = Vector3.new(0, -8.67000008, 0)
- MeshPart13.Transparency = 1
- MeshPart13.Size = Vector3.new(8.03480053, 4.87061262, 0.694280267)
- MeshPart13.Anchored = true
- MeshPart13.CanCollide = false
- MeshPart13.Material = Enum.Material.Fabric
- MeshPart13.TextureID = "rbxassetid://12680129"
- MeshPart14.Name = "8"
- MeshPart14.Parent = Model11
- MeshPart14.CFrame = CFrame.new(-7.54881001, 10.0700817, 7.66772699, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
- MeshPart14.Orientation = Vector3.new(0, -8.67000008, 0)
- MeshPart14.Position = Vector3.new(-7.54881001, 10.0700817, 7.66772699)
- MeshPart14.Rotation = Vector3.new(0, -8.67000008, 0)
- MeshPart14.Transparency = 1
- MeshPart14.Size = Vector3.new(7.95339441, 4.87071705, 1.15461898)
- MeshPart14.Anchored = true
- MeshPart14.CanCollide = false
- MeshPart14.Material = Enum.Material.Fabric
- MeshPart14.TextureID = "rbxassetid://12680129"
- MeshPart15.Name = "7"
- MeshPart15.Parent = Model11
- MeshPart15.CFrame = CFrame.new(-7.54896402, 10.0700817, 7.68391895, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
- MeshPart15.Orientation = Vector3.new(0, -8.67000008, 0)
- MeshPart15.Position = Vector3.new(-7.54896402, 10.0700817, 7.68391895)
- MeshPart15.Rotation = Vector3.new(0, -8.67000008, 0)
- MeshPart15.Transparency = 1
- MeshPart15.Size = Vector3.new(7.96737194, 4.87044287, 1.12576425)
- MeshPart15.Anchored = true
- MeshPart15.CanCollide = false
- MeshPart15.Material = Enum.Material.Fabric
- MeshPart15.TextureID = "rbxassetid://12680129"
- MeshPart16.Name = "6"
- MeshPart16.Parent = Model11
- MeshPart16.CFrame = CFrame.new(-7.53851509, 10.0700817, 7.70799398, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
- MeshPart16.Orientation = Vector3.new(0, -8.67000008, 0)
- MeshPart16.Position = Vector3.new(-7.53851509, 10.0700817, 7.70799398)
- MeshPart16.Rotation = Vector3.new(0, -8.67000008, 0)
- MeshPart16.Transparency = 1
- MeshPart16.Size = Vector3.new(7.98077869, 4.87044287, 1.04999006)
- MeshPart16.Anchored = true
- MeshPart16.CanCollide = false
- MeshPart16.Material = Enum.Material.Fabric
- MeshPart16.TextureID = "rbxassetid://12680129"
- MeshPart17.Name = "5"
- MeshPart17.Parent = Model11
- MeshPart17.CFrame = CFrame.new(-7.53116322, 10.0700817, 7.76419306, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
- MeshPart17.Orientation = Vector3.new(0, -8.67000008, 0)
- MeshPart17.Position = Vector3.new(-7.53116322, 10.0700817, 7.76419306)
- MeshPart17.Rotation = Vector3.new(0, -8.67000008, 0)
- MeshPart17.Transparency = 1
- MeshPart17.Size = Vector3.new(7.9919405, 4.87056875, 0.976310611)
- MeshPart17.Anchored = true
- MeshPart17.CanCollide = false
- MeshPart17.Material = Enum.Material.Fabric
- MeshPart17.TextureID = "rbxassetid://12680129"
- MeshPart18.Name = "4"
- MeshPart18.Parent = Model11
- MeshPart18.CFrame = CFrame.new(-7.52778721, 10.0700817, 7.81274605, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
- MeshPart18.Orientation = Vector3.new(0, -8.67000008, 0)
- MeshPart18.Position = Vector3.new(-7.52778721, 10.0700817, 7.81274605)
- MeshPart18.Rotation = Vector3.new(0, -8.67000008, 0)
- MeshPart18.Transparency = 1
- MeshPart18.Size = Vector3.new(7.99492025, 4.87044287, 0.911806703)
- MeshPart18.Anchored = true
- MeshPart18.CanCollide = false
- MeshPart18.Material = Enum.Material.Fabric
- MeshPart18.TextureID = "rbxassetid://12680129"
- MeshPart19.Name = "3"
- MeshPart19.Parent = Model11
- MeshPart19.CFrame = CFrame.new(-7.55119324, 10.0700817, 7.83592701, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
- MeshPart19.Orientation = Vector3.new(0, -8.67000008, 0)
- MeshPart19.Position = Vector3.new(-7.55119324, 10.0700817, 7.83592701)
- MeshPart19.Rotation = Vector3.new(0, -8.67000008, 0)
- MeshPart19.Transparency = 1
- MeshPart19.Size = Vector3.new(7.99696589, 4.87049198, 0.833267212)
- MeshPart19.Anchored = true
- MeshPart19.CanCollide = false
- MeshPart19.Material = Enum.Material.Fabric
- MeshPart19.TextureID = "rbxassetid://12680129"
- MeshPart20.Name = "9"
- MeshPart20.Parent = Model11
- MeshPart20.CFrame = CFrame.new(-7.53766108, 10.0700817, 7.66782188, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
- MeshPart20.Orientation = Vector3.new(0, -8.67000008, 0)
- MeshPart20.Position = Vector3.new(-7.53766108, 10.0700817, 7.66782188)
- MeshPart20.Rotation = Vector3.new(0, -8.67000008, 0)
- MeshPart20.Transparency = 1
- MeshPart20.Size = Vector3.new(7.94530439, 4.8706007, 1.14960659)
- MeshPart20.Anchored = true
- MeshPart20.CanCollide = false
- MeshPart20.Material = Enum.Material.Fabric
- MeshPart20.TextureID = "rbxassetid://12680129"
- MeshPart21.Name = "2"
- MeshPart21.Parent = Model11
- MeshPart21.CFrame = CFrame.new(-7.54603195, 10.0700817, 7.86853695, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
- MeshPart21.Orientation = Vector3.new(0, -8.67000008, 0)
- MeshPart21.Position = Vector3.new(-7.54603195, 10.0700817, 7.86853695)
- MeshPart21.Rotation = Vector3.new(0, -8.67000008, 0)
- MeshPart21.Transparency = 1
- MeshPart21.Size = Vector3.new(8.00397682, 4.87044287, 0.764522672)
- MeshPart21.Anchored = true
- MeshPart21.CanCollide = false
- MeshPart21.Material = Enum.Material.Fabric
- MeshPart21.TextureID = "rbxassetid://12680129"
- MeshPart22.Name = "14"
- MeshPart22.Parent = Model11
- MeshPart22.CFrame = CFrame.new(-7.52818108, 10.0700817, 7.84420776, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
- MeshPart22.Orientation = Vector3.new(0, -8.67000008, 0)
- MeshPart22.Position = Vector3.new(-7.52818108, 10.0700817, 7.84420776)
- MeshPart22.Rotation = Vector3.new(0, -8.67000008, 0)
- MeshPart22.Transparency = 1
- MeshPart22.Size = Vector3.new(8.02695942, 4.87044573, 0.801810205)
- MeshPart22.Anchored = true
- MeshPart22.CanCollide = false
- MeshPart22.Material = Enum.Material.Fabric
- MeshPart22.TextureID = "rbxassetid://12680129"
- MeshPart23.Name = "13"
- MeshPart23.Parent = Model11
- MeshPart23.CFrame = CFrame.new(-7.534729, 10.0700817, 7.78042889, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
- MeshPart23.Orientation = Vector3.new(0, -8.67000008, 0)
- MeshPart23.Position = Vector3.new(-7.534729, 10.0700817, 7.78042889)
- MeshPart23.Rotation = Vector3.new(0, -8.67000008, 0)
- MeshPart23.Transparency = 1
- MeshPart23.Size = Vector3.new(8.00423145, 4.87044287, 0.907351136)
- MeshPart23.Anchored = true
- MeshPart23.CanCollide = false
- MeshPart23.Material = Enum.Material.Fabric
- MeshPart23.TextureID = "rbxassetid://12680129"
- MeshPart24.Name = "12"
- MeshPart24.Parent = Model11
- MeshPart24.CFrame = CFrame.new(-7.533885, 10.0700817, 7.73129606, 0.988568902, 0, -0.150769979, 0, 1, 0, 0.150769979, 0, 0.988568902)
- MeshPart24.Orientation = Vector3.new(0, -8.67000008, 0)
- MeshPart24.Position = Vector3.new(-7.533885, 10.0700817, 7.73129606)
- MeshPart24.Rotation = Vector3.new(0, -8.67000008, 0)
- MeshPart24.Transparency = 1
- MeshPart24.Size = Vector3.new(7.97911882, 4.87044287, 1.00681031)
- MeshPart24.Anchored = true
- MeshPart24.CanCollide = false
- MeshPart24.Material = Enum.Material.Fabric
- MeshPart24.TextureID = "rbxassetid://12680129"
- MeshPart25.Name = "11"
- MeshPart25.Parent = Model11
- MeshPart25.CFrame = CFrame.new(-7.53773308, 10.0700817, 7.69966888, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
- MeshPart25.Orientation = Vector3.new(0, -8.67000008, 0)
- MeshPart25.Position = Vector3.new(-7.53773308, 10.0700817, 7.69966888)
- MeshPart25.Rotation = Vector3.new(0, -8.67000008, 0)
- MeshPart25.Transparency = 1
- MeshPart25.Size = Vector3.new(7.95706892, 4.87054634, 1.06984007)
- MeshPart25.Anchored = true
- MeshPart25.CanCollide = false
- MeshPart25.Material = Enum.Material.Fabric
- MeshPart25.TextureID = "rbxassetid://12680129"
- MeshPart26.Name = "10"
- MeshPart26.Parent = Model11
- MeshPart26.CFrame = CFrame.new(-7.5421772, 10.0700817, 7.68396711, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
- MeshPart26.Orientation = Vector3.new(0, -8.67000008, 0)
- MeshPart26.Position = Vector3.new(-7.5421772, 10.0700817, 7.68396711)
- MeshPart26.Rotation = Vector3.new(0, -8.67000008, 0)
- MeshPart26.Transparency = 1
- MeshPart26.Size = Vector3.new(7.94132566, 4.87067795, 1.12007439)
- MeshPart26.Anchored = true
- MeshPart26.CanCollide = false
- MeshPart26.Material = Enum.Material.Fabric
- MeshPart26.TextureID = "rbxassetid://12680129"
- MeshPart27.Name = "1"
- MeshPart27.Parent = Model11
- MeshPart27.CFrame = CFrame.new(-7.54079008, 10.0700817, 7.8844552, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
- MeshPart27.Orientation = Vector3.new(0, -8.67000008, 0)
- MeshPart27.Position = Vector3.new(-7.54079008, 10.0700817, 7.8844552)
- MeshPart27.Rotation = Vector3.new(0, -8.67000008, 0)
- MeshPart27.Size = Vector3.new(8.01558018, 4.87044287, 0.694967031)
- MeshPart27.Anchored = true
- MeshPart27.CanCollide = false
- MeshPart27.Material = Enum.Material.Fabric
- MeshPart27.TextureID = "rbxassetid://12680129"
- Script28.Name = "qPerfectionWeld"
- Script28.Parent = Tool0
- table.insert(cors,sandbox(Script28,function()
- -- Created by Quenty (@Quenty, follow me on twitter).
- -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
- -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
- --[[ INSTRUCTIONS
- - Place in the model
- - Make sure model is anchored
- - That's it. It will weld the model and all children.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes.
- ]]
- --[[ DOCUMENTATION
- - Will work in tools. If ran more than once it will not create more than one weld. This is especially useful for tools that are dropped and then picked up again.
- - Will work in PBS servers
- - Will work as long as it starts out with the part anchored
- - Stores the relative CFrame as a CFrame value
- - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
- - Utilizes a recursive algorith to find all parts in the model
- - Will reweld on script reparent if the script is initially parented to a tool.
- - Welds as fast as possible
- ]]
- -- qPerfectionWeld.lua
- -- Created 10/6/2014
- -- Author: Quenty
- -- Version 1.0.3
- -- Updated 10/14/2014 - Updated to 1.0.1
- --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
- -- Updated 10/14/2014 - Updated to 1.0.2
- --- Fixed bug fix.
- -- Updated 10/14/2014 - Updated to 1.0.3
- --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
- local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
- local function CallOnChildren(Instance, FunctionToCall)
- -- Calls a function on each of the children of a certain object, using recursion.
- FunctionToCall(Instance)
- for _, Child in next, Instance:GetChildren() do
- CallOnChildren(Child, FunctionToCall)
- end
- end
- local function GetNearestParent(Instance, ClassName)
- -- Returns the nearest parent of a certain class, or returns nil
- local Ancestor = Instance
- repeat
- Ancestor = Ancestor.Parent
- if Ancestor == nil then
- return nil
- end
- until Ancestor:IsA(ClassName)
- return Ancestor
- end
- local function GetBricks(StartInstance)
- local List = {}
- -- if StartInstance:IsA("BasePart") then
- -- List[#List+1] = StartInstance
- -- end
- CallOnChildren(StartInstance, function(Item)
- if Item:IsA("BasePart") then
- List[#List+1] = Item;
- end
- end)
- return List
- end
- local function Modify(Instance, Values)
- -- Modifies an Instance by using a table.
- assert(type(Values) == "table", "Values is not a table");
- for Index, Value in next, Values do
- if type(Index) == "number" then
- Value.Parent = Instance
- else
- Instance[Index] = Value
- end
- end
- return Instance
- end
- local function Make(ClassType, Properties)
- -- Using a syntax hack to create a nice way to Make new items.
- return Modify(Instance.new(ClassType), Properties)
- end
- local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
- local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
- local function HasWheelJoint(Part)
- for _, SurfaceName in pairs(Surfaces) do
- for _, HingSurfaceName in pairs(HingSurfaces) do
- if Part[SurfaceName].Name == HingSurfaceName then
- return true
- end
- end
- end
- return false
- end
- local function ShouldBreakJoints(Part)
- --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
- -- definitely some edge cases.
- if NEVER_BREAK_JOINTS then
- return false
- end
- if HasWheelJoint(Part) then
- return false
- end
- local Connected = Part:GetConnectedParts()
- if #Connected == 1 then
- return false
- end
- for _, Item in pairs(Connected) do
- if HasWheelJoint(Item) then
- return false
- elseif not Item:IsDescendantOf(script.Parent) then
- return false
- end
- end
- return true
- end
- local function WeldTogether(Part0, Part1, JointType, WeldParent)
- --- Weld's 2 parts together
- -- @param Part0 The first part
- -- @param Part1 The second part (Dependent part most of the time).
- -- @param [JointType] The type of joint. Defaults to weld.
- -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
- -- @return The weld created.
- JointType = JointType or "Weld"
- local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
- local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
- Modify(NewWeld, {
- Name = "qCFrameWeldThingy";
- Part0 = Part0;
- Part1 = Part1;
- C0 = CFrame.new();--Part0.CFrame:inverse();
- C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
- Parent = Part1;
- })
- if not RelativeValue then
- RelativeValue = Make("CFrameValue", {
- Parent = Part1;
- Name = "qRelativeCFrameWeldValue";
- Archivable = true;
- Value = NewWeld.C1;
- })
- end
- return NewWeld
- end
- local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
- -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
- -- @param MainPart The part to weld the model to (can be in the model).
- -- @param [JointType] The type of joint. Defaults to weld.
- -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
- for _, Part in pairs(Parts) do
- if ShouldBreakJoints(Part) then
- Part:BreakJoints()
- end
- end
- for _, Part in pairs(Parts) do
- if Part ~= MainPart then
- WeldTogether(MainPart, Part, JointType, MainPart)
- end
- end
- if not DoNotUnanchor then
- for _, Part in pairs(Parts) do
- Part.Anchored = false
- end
- MainPart.Anchored = false
- end
- end
- local function PerfectionWeld()
- local Tool = GetNearestParent(script, "Tool")
- local Parts = GetBricks(script.Parent)
- local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
- if PrimaryPart then
- WeldParts(Parts, PrimaryPart, "Weld", false)
- else
- warn("qWeld - Unable to weld part")
- end
- return Tool
- end
- local Tool = PerfectionWeld()
- if Tool and script.ClassName == "Script" then
- --- Don't bother with local scripts
- script.Parent.AncestryChanged:connect(function()
- PerfectionWeld()
- end)
- end
- -- Created by Quenty (@Quenty, follow me on twitter).
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Backpack
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement