pinopoly1
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 6914 |
|
|
| 27 Sep 2012 04:29 PM |
so it dosent need a baseplate u click and claim... i just want it to automatically let u you it when you enter.
local Tool = script.Parent local Player = Tool.Parent.Parent
while not Player.Character do wait(0.1) end wait(0.5)
local Base = nil for _,Child in pairs(game.Workspace.Bases:children()) do if Child.Owner.Value == Player.Name then Base = Child end end local Sel = nil local SelB = nil local Origin = nil local Turn = 0 local Gui = nil local List = game.Lighting["Game Blocks"]:children()[1].Name local Page = 1
function Alert(Msg) local Alerts = Player.PlayerGui:findFirstChild("Alert") if Alerts then local msg = Instance.new("StringValue") msg.Name = "Msg" msg.Value = Msg msg.Parent = Alerts.Controle end end
function Round(Num) return math.floor(Num+0.5) end
function GetParts(Obj) local P = {} local z = false for _,Class in pairs({"Part","WedgePart","TrussPart","CornerWedgePart"}) do if Obj:IsA(Class) then z = true table.insert(P,Obj) end end if not z then for _,Child in pairs(Obj:children()) do local Ps = GetParts(Child) for _,child in pairs(Ps) do table.insert(P,child) end end end return P end
function UpdateList() local S = game.Lighting["Game Blocks"][List]:children() local X = Gui.F.Fill.Insert.AbsoluteSize.X local Y = Gui.F.Fill.Insert.AbsoluteSize.Y local Xs = math.floor(X/100) local Ys = math.floor(Y/100) local MaxPages = math.ceil(#S/(Ys*Xs)) for _,Child in pairs(Gui.F.Fill.Insert:children()) do Child:remove() end local xs = 0 local ys = 0 if MaxPages == 0 or MaxPages == math.huge then Gui.F.Fill.Page.Text = "No Pages" elseif MaxPages < Page then Page = MaxPages if Page < 1 then Page = 1 end Gui.F.Fill.Page.Text = "Page: "..Page.."/"..Page elseif Page < 1 then Page = 1 Gui.F.Fill.Page.Text = "Page: "..Page.."/"..MaxPages else Gui.F.Fill.Page.Text = "Page: "..Page.."/"..MaxPages end if #S > (Page-1)*(Ys*Xs)+(Ys*Xs) then Gui.F.Fill.Next.Visible = true else Gui.F.Fill.Next.Visible = false end if Page > 1 then Gui.F.Fill.Back.Visible = true else Gui.F.Fill.Back.Visible = false end for i = 1, Ys*Xs do local Obj = Tool.Obj:clone() Obj.Parent = Gui.F.Fill.Insert local x = UDim.new(0,0) if xs < Xs then x = UDim.new(0,xs*(X/Xs)) xs = xs+1 else xs = 1 ys = ys+1 end local y = UDim.new(0,ys*(Y/Ys)) Obj.Position = UDim2.new(0,x.Offset,0,y.Offset) local Cur = S[(Page-1)*(Ys*Xs)+i] if Cur then Obj.Text.Text = Cur.Name if Cur.Img.Value ~= "" then Obj.Image.Image = "http://www.roblox.com/Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=110&ht=110&aid="..Cur.Img.Value else Obj.Image.Image = "http://www.roblox.com/asset/?id=43891457" end Obj.Image.MouseButton1Down:connect(function() if Sel then Sel:remove() Sel = nil end Sel = Cur:clone() Sel.Parent = Player.Character if not SelB then SelB = Instance.new("SelectionBox") SelB.Color = BrickColor.new("Bright green") SelB.Parent = Player.PlayerGui end SelB.Adornee = Sel.Center Gui.F.Visible = false Gui.F2.Img.Image = Obj.Image.Image Gui.F2.name.Text = Cur.Name Gui.F2.Visible = true Player.PlayerGui.Chat.MsgsF.Visible = true for _,Child in pairs(GetParts(Sel)) do if Child.Name ~= "Center" then Child.Material = Enum.Material.Plastic Child.CanCollide = false Child.Transparency = 0.5 end end Origin = Cur end) Obj.Image.MouseEnter:connect(function() local Info = Gui.F.Fill.Info Info.Img.Image = Obj.Image.Image Info.ObjName.Text = Cur.Name local P,S,R = Cur:findFirstChild("Properties"),Cur:findFirstChild("Scripts"),Cur:findFirstChild("Resizeable") if P then Info.PropsImg.Image = "http://www.roblox.com/asset/?id=44331557" else Info.PropsImg.Image = "http://www.roblox.com/asset/?id=44331301" end if S then Info.ScriptsImg.Image = "http://www.roblox.com/asset/?id=44331557" else Info.ScriptsImg.Image = "http://www.roblox.com/asset/?id=44331301" end if R then Info.ResizeImg.Image = "http://www.roblox.com/asset/?id=44331557" else Info.ResizeImg.Image = "http://www.roblox.com/asset/?id=44331301" end end) Obj.Text.MouseButton1Down:connect(function() if Sel then Sel:remove() Sel = nil end Sel = Cur:clone() Sel.Parent = Player.Character if not SelB then SelB = Instance.new("SelectionBox") SelB.Parent = Player.PlayerGui end SelB.Adornee = Sel.Center Gui.F.Visible = false Gui.F2.Img.Image = Obj.Image.Image Gui.F2.name.Text = Cur.Name Gui.F2.Visible = true Player.PlayerGui.Chat.MsgsF.Visible = true for _,Child in pairs(GetParts(Sel)) do if Child.Name ~= "Center" then Child.Material = Enum.Material.Plastic Child.CanCollide = false Child.Transparency = 0.5 end end Origin = Cur end) Obj.Text.MouseEnter:connect(function() local Info = Gui.F.Fill.Info Info.Img.Image = Obj.Image.Image Info.ObjName.Text = Cur.Name local P,S,R = Cur:findFirstChild("Properties"),Cur:findFirstChild("Scripts"),Cur:findFirstChild("Resizeable") if P then Info.PropsImg.Image = "http://www.roblox.com/asset/?id=44331557" else Info.PropsImg.Image = "http://www.roblox.com/asset/?id=44331301" end if S then Info.ScriptsImg.Image = "http://www.roblox.com/asset/?id=44331557" else Info.ScriptsImg.Image = "http://www.roblox.com/asset/?id=44331301" end if R then Info.ResizeImg.Image = "http://www.roblox.com/asset/?id=44331557" else Info.ResizeImg.Image = "http://www.roblox.com/asset/?id=44331301" end end) else Obj.Visible = false end end end
function PosSel(M) if M.Target then local T = 0 if Round(Turn/2)*2 == Round(Turn) then T = 0 else T = 1 end local X local Y local Z local Mult local Tar = M.Target local Surface = M.TargetSurface if T == 0 then if Round(Sel.Center.Size.x/8)*8 == Round(Sel.Center.Size.x) then X = 0 else X = 2 end if Round(Sel.Center.Size.y/8)*8 == Round(Sel.Center.Size.y) then Y = 0 else Y = 2 end if Round(Sel.Center.Size.z/8)*8 == Round(Sel.Center.Size.z) then Z = 0 else Z = 2 end if Surface == Enum.NormalId.Top or Surface == Enum.NormalId.Bottom then Mult = Sel.Center.Size.y/2 elseif Surface == Enum.NormalId.Front or Surface == Enum.NormalId.Back then Mult = Sel.Center.Size.z/2 elseif Surface == Enum.NormalId.Left or Surface == Enum.NormalId.Right then Mult = Sel.Center.Size.x/2 end elseif T == 1 then if Round(Sel.Center.Size.z/8)*8 == Round(Sel.Center.Size.z) then X = 0 else X = 2 end if Round(Sel.Center.Size.y/8)*8 == Round(Sel.Center.Size.y) then Y = 0 else Y = 2 end if Round(Sel.Center.Size.x/8)*8 == Round(Sel.Center.Size.x) then Z = 0 else Z = 2 end if Surface == Enum.NormalId.Top or Surface == Enum.NormalId.Bottom then Mult = Sel.Center.Size.y/2 elseif Surface == Enum.NormalId.Front or Surface == Enum.NormalId.Back then Mult = Sel.Center.Size.x/2 elseif Surface == Enum.NormalId.Left or Surface == Enum.NormalId.Right then Mult = Sel.Center.Size.z/2 end end local x,y,z = Tar.CFrame:toEulerAnglesXYZ() local Pos = CFrame.new(M.Hit.p) * CFrame.fromEulerAnglesXYZ(x,y,z) * CFrame.new(Vector3.FromNormalId(Surface) * Mult) local CF = CFrame.new(Round((Pos.X-X)/4)*4+X,Round((Pos.Y-Y-0.8)/4)*4+0.8+Y,Round((Pos.Z-Z)/4)*4+Z) * CFrame.fromEulerAnglesXYZ(0,(math.pi/2)*Turn,0) local Parts = GetParts(Sel) Sel.Center.CFrame = CF for _,Child in pairs(Parts) do if Child.Name ~= "Center" then Child.CFrame = Sel.Center.CFrame * Child.CF.Value end end end end
Tool.Selected:connect(function(M) if not Base then Alert("Please choose a base to build on.") M.Button1Down:connect(function() if not Base then if M.Target then if M.Target.Parent.Parent == game.Workspace.Bases and M.Target.Name == "Center" then if M.Target.Parent.Owner.Value == "" then M.Target.Parent.Owner.Value = Player.Name Base = M.Target.Parent local VT = Player:findFirstChild("VipType") if VT then if VT.Value > 0 then local Pos = Base.Center.Position Base.Center.Size = Vector3.new(200,0.4,200) Base.Center.CFrame = CFrame.new(Pos) end end else Alert("You can't choose that base. "..M.Target.Parent.Owner.Value.." is already using it.") end end end end end) while not Base do wait(0.1) end end Player.PlayerGui.Chat.MsgsF.Visible = false if gui then gui:remove() end Gui = Tool.BuildGui:clone() Gui.Parent = Player.PlayerGui local GBsChildren = game.Lighting["Game Blocks"]:children() for x,Selection in pairs(GBsChildren) do local DB = Tool.DropButton:clone() DB.B1.Text = Selection.Name DB.Size = UDim2.new(1,0,1/#GBsChildren,0) DB.Position = UDim2.new(0,0,(x-1)/#GBsChildren,0) DB.Parent = Gui.F.Fill.Dropped DB.MouseButton1Down:connect(function() List = Selection.Name Page = 1 Gui.F.Fill.Drop.Text.Text = Selection.Name Gui.F.Fill.Dropped.Visible = false UpdateList() end) DB.B1.MouseButton1Down:connect(function() List = Selection.Name Page = 1 Gui.F.Fill.Drop.Text.Text = Selection.Name Gui.F.Fill.Dropped.Visible = false UpdateList() end) end Page = 1 UpdateList() Gui.F.Fill.Insert.Changed:connect(function(Prop) if Prop == "AbsoluteSize" then UpdateList() end end) Gui.F.Fill.Drop.MouseButton1Down:connect(function() if Gui.F.Fill.Dropped.Visible == false then Gui.F.Fill.Dropped.Visible = true else Gui.F.Fill.Dropped.Visible = false end end) Gui.F.Fill.Drop.Text.MouseButton1Down:connect(function() if Gui.F.Fill.Dropped.Visible == false then Gui.F.Fill.Dropped.Visible = true else Gui.F.Fill.Dropped.Visible = false end end) Gui.F.Fill.Next.MouseButton1Down:connect(function() Page = Page+1 UpdateList() end) Gui.F.Fill.Back.MouseButton1Down:connect(function() Page = Page-1 UpdateList() end) Gui.F2.Back.MouseButton1Down:connect(function() Gui.F.Visible = true Gui.F2.Visible = false Player.PlayerGui.Chat.MsgsF.Visible = false if Sel then Sel:remove() Sel = nil end end) M.Move:connect(function() if Sel then PosSel(M) end end) M.Button1Down:connect(function() if Sel then PosSel(M) -- local BasePos = Base.Pos local Poses = {} for x = 4, Sel.Center.Size.x, 4 do local X = x-Sel.Center.Size.x/2-2 for y = 4, Sel.Center.Size.y, 4 do local Y = y-Sel.Center.Size.y/2-2 for z = 4, Sel.Center.Size.z, 4 do local Z = z-Sel.Center.Size.z/2-2 local CF = Sel.Center.CFrame * CFrame.new(X,Y,Z) table.insert(Poses,{Round(CF.X),Round(CF.Y/0.01)*0.01,Round(CF.Z)}) end end end local z = true for _,Pos in pairs(Poses) do if not z then break end if Pos[2] < 2.75 or Pos[1] > Base.Center.Position.x+(Base.Center.Size.x/2) or Pos[1] < Base.Center.Position.x-(Base.Center.Size.x/2) or Pos[3] > Base.Center.Position.z+(Base.Center.Size.z/2) or Pos[3] < Base.Center.Position.z-(Base.Center.Size.z/2) then z = false break end --[[ for _,pos in pairs(BasePos:children()) do if Pos[1] == Round(pos.Value.x) and Pos[2] == Round(pos.Value.y/0.01)*0.01 and Pos[3] == Round(pos.Value.z) then z = false break end end]] end if z then local NSel = Origin:clone() local Center = NSel.Center Center.CFrame = Sel.Center.CFrame for _,Child in pairs(GetParts(NSel)) do if Child.Name ~= "Center" then Child.CFrame = Center.CFrame * Child.CF.Value if Child:IsA("Seat") or Child:IsA("VehicleSeat") then local W = Instance.new("Weld") W.C0 = Base.Center.CFrame:inverse() * Child.CFrame W.Part0 = Base.Center W.Part1 = Child W.Parent = Child Child.Anchored = false end end end local CFVal = Instance.new("CFrameValue") CFVal.Value = Center.CFrame CFVal.Name = "CenterCF" CFVal.Parent = NSel local Size = Instance.new("Vector3Value") Size.Value = Center.Size Size.Name = "Size" Size.Parent = NSel NSel.Parent = Base.Parts Center:remove() local Scripts = NSel:findFirstChild("Scripts") if Scripts then for _,Script in pairs(Scripts:children()) do Script.Disabled = false end end --[[ for _,Pos in pairs(Poses) do local Val = Instance.new("Vector3Value") Val.Value = Vector3.new(Pos[1],Pos[2],Pos[3]) Val.Parent = BasePos end]] PosSel(M) else Alert("You can't place that there.") end end end) M.KeyDown:connect(function(K) if K == "r" then Turn = Turn+1 if Turn > 4 then Turn = 1 end if Sel then PosSel(M) end end end) end)
Tool.Deselected:connect(function() Player.PlayerGui.Chat.MsgsF.Visible = true if Gui then Gui:remove() Gui = nil end if Sel then Sel:remove() Sel = nil end if SelB then SelB:remove() SelB = nil end end)
|
|
|
| Report Abuse |
|
| |
POC0bob
|
  |
| Joined: 20 Feb 2010 |
| Total Posts: 549 |
|
|
| 27 Sep 2012 06:49 PM |
| I have NO idea what you want us to do, all i see is a bunch of code that means nothing to me, and a request with very bad English, that makes no since to me.. |
|
|
| Report Abuse |
|