Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-3

Will this work?

Asked by
Regg12 0
10 years ago

-- 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 = {11744447,18881789,18881808} 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(music) 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.. MV

1 answer

Log in to vote
1
Answered by 10 years ago

So you're just asking if it will work? Why not try it then ask for help?

1
And also, use code block next time! alessandro112 161 — 10y
Ad

Answer this question