null nil true true 0 0 0 1 0 0 0 1 0 0 0 1 PartSelection http://www.roblox.com/asset/?id=73241762 New Parts false -0.5 0.5 0 0 -0.5 0.5 4 0 194 0 15.6000004 0 1 0 0 0 1 0 0 0 1 true 0.5 0.300000012 -0.5 0.5 0 0 -0.5 0.5 0 0 true 256 Handle 0 -0.5 0.5 0 0 0 0 0 -0.5 0.5 3 0 0 0 0 0 1 1 4 1.20000005 2 2 2 http://www.roblox.com/asset/?id=42163552 5 Mesh 0 0 0 0.899999976 0.899999976 0.899999976 http://www.roblox.com/asset/?id=42163513 1 1 1 false PartSelectionScript -- basic functions function waitForChild(instance, name) while not instance:FindFirstChild(name) do instance.ChildAdded:wait() end end function waitForProperty(instance, name) while not instance[name] do instance.Changed:wait() end end function getPlayer() waitForProperty(game.Players,"LocalPlayer") return game.Players.LocalPlayer end -- Locals local Tool = script.Parent waitForProperty(game,"PlaceId") local isRestricted = (game.PlaceId == 41324860 or game.PlaceId == 129686177) local setPanelVisibility, getPanelVisibility, waterTypeChangedEvent = nil local waterForceAndDirection = {"None","NegX"} local currStampId = nil local testIds = {30515630} if isRestricted then table.insert(testIds,2409156) table.insert(testIds,19238067) table.insert(testIds,19238114) else table.insert(testIds,18881829) table.insert(testIds,18881853) table.insert(testIds,18881866) end local RbxStamper = LoadLibrary("RbxStamper") local RbxGui = LoadLibrary("RbxGui") if not RbxStamper then error("Error: RbxStamper Library Load Fail! Returning") return nil end if not RbxGui then error("Error: RbxGui Library Load Fail! Returning") return nil end local stampControl = nil local stampCon = nil local lastStampModel = nil local modelToStampIn, stampRegion = nil local mouse = nil local currStampGui = nil waitForChild(script.Parent,"PartSelectionHintGui") waitForChild(script.Parent.PartSelectionHintGui, "SelectionHint") local hintGui = script.Parent.PartSelectionHintGui local shortcutHint = hintGui.SelectionHint local showBaseplateScript = nil local hideBaseplateScript = nil if isRestricted then waitForChild(getPlayer(), "PlayerGui") waitForChild(getPlayer().PlayerGui, "Waypoint") waitForChild(getPlayer().PlayerGui, "showBaseplateWaypoint") waitForChild(getPlayer().PlayerGui, "hideBaseplateWaypoint") showBaseplateScript = getPlayer().PlayerGui.showBaseplateWaypoint hideBaseplateScript = getPlayer().PlayerGui.hideBaseplateWaypoint end -- functions function getRecentPartTool() if game.Players["LocalPlayer"] then local backpack = game.Players.LocalPlayer:FindFirstChild("Backpack") if backpack and backpack:IsA("Backpack") then local recentPartTool = backpack:FindFirstChild("RecentParts") if recentPartTool and recentPartTool:IsA("Tool") then return recentPartTool end end end return nil end function addToRecentPartList(id, terrainShape) local recentTool = getRecentPartTool() if recentTool then local addRecentPart = recentTool:FindFirstChild("AddRecentPart",true) if addRecentPart then addRecentPart:Invoke(tonumber(id),tonumber(terrainShape)) end end end function keyHandler(key) if not key then return end key = string.lower(key) if key == 'q' then if currStampGui then currStampGui.SetPanel.Visible = true shortcutHint.Visible = false if stampControl then stampControl.Destroy() -- need to remove our stamping object end end end end function showLoadingDialog() if currStampGui then currStampGui.LoadingFrame.LoadingText:TweenPosition(UDim2.new(0,150,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 2, true) currStampGui.LoadingFrame.Visible = true end end function hideLoadingDialog() if currStampGui then currStampGui.LoadingFrame.LoadingText:TweenPosition(UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.1, true) currStampGui.LoadingFrame.Visible = false end end function hint(phrase, timeLength) waitForChild(game.Players.LocalPlayer.PlayerGui,"topHint") waitForChild(game.Players.LocalPlayer.PlayerGui.topHint, "Add") waitForChild(game.Players.LocalPlayer.PlayerGui.topHint.Add, "Label") waitForChild(game.Players.LocalPlayer.PlayerGui.topHint.Add, "Time") game.Players.LocalPlayer.PlayerGui.topHint.Add.Label.Value = tostring(phrase) game.Players.LocalPlayer.PlayerGui.topHint.Add.Time.Value = tonumber(timeLength) game.Players.LocalPlayer.PlayerGui.topHint.Add.Disabled = false end function showBaseplateWaypoint() if modelToStampIn and showBaseplateScript then local target = showBaseplateScript:FindFirstChild("target") if target then delay(0,function() target.Value = modelToStampIn.Parent:FindFirstChild("RegionBounds") showBaseplateScript.Disabled = false showBaseplateScript.Disabled = true wait(8) hideBaseplateScript.Disabled = false hideBaseplateScript.Disabled = true end) end end end function stampAttemptFailed() hint("You can only stamp in your baseplate", 5) showBaseplateWaypoint() end function hasPoints() waitForChild(game.Players.LocalPlayer, "MaxPoints") local maxPoints = game.Players.LocalPlayer.MaxPoints waitForChild(game.Players.LocalPlayer, "PointsUsed") local pointsUsed = game.Players.LocalPlayer.PointsUsed return ( (pointsUsed.Value/maxPoints.Value) < 1 ) end function setupStamper(model, mouse) if model then if isRestricted then if not hasPoints() then hint("Too many parts stamped, delete some to stamp more", 5) return else stampControl = RbxStamper.SetupStamperDragger(model, mouse, modelToStampIn, stampRegion, stampAttemptFailed) end else stampControl = RbxStamper.SetupStamperDragger(model, mouse) end if stampControl then stampCon = stampControl.Stamped.Changed:connect(function() if stampControl.Stamped.Value then if isRestricted and not hasPoints() then hint("Too many parts stamped, delete some to stamp more", 5) if stampCon then stampCon:disconnect() end stampControl.Destroy() else stampControl.ReloadModel() end end end) end end end function makeLoadingGui(parent) local newLoadingFrame = Instance.new("Frame") newLoadingFrame.Name = "LoadingFrame" newLoadingFrame.Style = Enum.FrameStyle.RobloxRound newLoadingFrame.Size = UDim2.new(0,350,0,60) newLoadingFrame.Visible = false newLoadingFrame.Position = UDim2.new(0.5,-175,0.5,-30) local loadingText = Instance.new("TextLabel") loadingText.Name = "LoadingText" loadingText.BackgroundTransparency = 1 loadingText.Size = UDim2.new(0,155,1,0) loadingText.Font = Enum.Font.ArialBold loadingText.FontSize = Enum.FontSize.Size36 loadingText.Text = "Loading..." loadingText.TextColor3 = Color3.new(1,1,1) loadingText.TextStrokeTransparency = 0 loadingText.Parent = newLoadingFrame newLoadingFrame.Parent = parent end function updateWaterInfo() if stampControl then stampControl.Destroy() end if stampCon then stampCon:disconnect() stampCon = nil end showLoadingDialog() lastStampModel = RbxStamper.GetStampModel(currStampId) hideLoadingDialog() if lastStampModel.Name == "MegaClusterCube" then local clusterTag = lastStampModel:FindFirstChild("ClusterMaterial") -- we are going to stamp water, send info to stamper about this if clusterTag and clusterTag.Value.X == 17 then local waterForceTag = Instance.new("StringValue",lastStampModel) waterForceTag.Name = "WaterForceTag" waterForceTag.Value = waterForceAndDirection[1] local waterForceDirectionTag = Instance.new("StringValue",lastStampModel) waterForceDirectionTag.Name = "WaterForceDirectionTag" waterForceDirectionTag.Value = waterForceAndDirection[2] end end setupStamper(lastStampModel, mouse) end function initStamper() local partSelected = function(name, id, terrainShape) if stampControl then stampControl.Destroy() end if stampCon then stampCon:disconnect() stampCon = nil end currStampId = id currStampGui.SetPanel.Visible = false shortcutHint.Visible = true showLoadingDialog() lastStampModel = RbxStamper.GetStampModel(id, terrainShape) addToRecentPartList(id, terrainShape) setupStamper(lastStampModel, mouse) hideLoadingDialog() if lastStampModel.Name == "MegaClusterCube" then local clusterTag = lastStampModel:FindFirstChild("ClusterMaterial") -- we are going to stamp water, send info to stamper about this if clusterTag and clusterTag.Value.X == 17 then local waterForceTag = Instance.new("StringValue",lastStampModel) waterForceTag.Name = "WaterForceTag" waterForceTag.Value = waterForceAndDirection[1] local waterForceDirectionTag = Instance.new("StringValue",lastStampModel) waterForceDirectionTag.Name = "WaterForceDirectionTag" waterForceDirectionTag.Value = waterForceAndDirection[2] updateWaterInfo() end end end local dialogClosed = function() if lastStampModel then if stampControl then stampControl.Destroy() end setupStamper(lastStampModel, mouse) end end currStampGui, setPanelVisibility, getPanelVisibility, waterTypeChangedEvent = RbxGui.CreateSetPanel(testIds, partSelected, dialogClosed, UDim2.new(0.6,-58,0.64,0), UDim2.new(0.2,29,0.1,24)) makeLoadingGui(currStampGui) currStampGui.Parent = getPlayer().PlayerGui hintGui.Parent = getPlayer().PlayerGui waterTypeChangedEvent.Event:connect(function(waterTable) waterForceAndDirection = waterTable updateWaterInfo() end) end function onEquippedLocal(newMouse) if not getPlayer() then return end mouse = newMouse mouse.Icon = "http://www.roblox.com/asset?id=66887745" if not firstEquip and currStampGui then currStampGui.Parent = getPlayer().PlayerGui hintGui.Parent = getPlayer().PlayerGui currStampGui.SetPanel.Visible = true shortcutHint.Visible = false else initStamper() end keyCon = mouse.KeyDown:connect(function(key) keyHandler(key) end) end function nukeState() if currStampGui then currStampGui.Parent = nil end if hintGui.Parent then hintGui.Parent = nil end if stampControl then stampControl:Destroy() end if keyCon then keyCon:disconnect() keyCon = nil end end function onUnequippedLocal() hideLoadingDialog() nukeState() end ---------------------------------------------------------------------------------------- if isRestricted then -- setup our variables waitForChild(game,"Workspace") waitForChild(game.Workspace, "BuildingAreas") waitForChild(game.Workspace.BuildingAreas, "Area1") waitForChild(game.Workspace.BuildingAreas, "Area9") -- all areas loaded while not modelToStampIn do -- check for build area until we find one local buildAreas = game.Workspace.BuildingAreas:GetChildren() for i = 1, #buildAreas do if buildAreas[i]:IsA("Model") then waitForChild(buildAreas[i],"Player") if buildAreas[i].Player.Value == game.Players.LocalPlayer.Name then waitForChild(buildAreas[i],"PlayerArea") modelToStampIn = buildAreas[i].PlayerArea break end end end if not modelToStampIn then wait(0.5) end end local lowPos = modelToStampIn.Parent:FindFirstChild("LowPos") local highPos = modelToStampIn.Parent:FindFirstChild("HighPos") if not lowPos or highPos then wait(0.5) lowPos = modelToStampIn.Parent:FindFirstChild("LowPos") highPos = modelToStampIn.Parent:FindFirstChild("HighPos") end while lowPos.Value == Vector3.new(0,0,0) or highPos.Value == Vector3.new(0,0,0) do wait(0.5) end -- tool doesn't work until these are defined stampRegion = Region3.new(lowPos.Value, highPos.Value) -- this is where we can stamp end Tool.Equipped:connect(onEquippedLocal) Tool.Unequipped:connect(onUnequippedLocal) PartSelectionHintGui false 4278190080 0.5 4279970357 1 false false 2 5 SelectionHint 0.5 -85 0 0 0 170 0 30 0 Press Q to show Part List 4294967295 false 4278190080 0 0 false 2 1 false 1