Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local plr = owner
- local blockType = 'Grass'
- local rot = Vector3.new()
- local colorid = 1
- local clickid = 1
- local _clickid = 1
- local blockmode = 1
- local totalblocks = 0
- local selectmode = 1
- local currentnotify
- local preplace = nil
- local preplacepart = nil
- local highlight = nil
- local placing = true
- local holding = false
- local lastmpos = nil
- local lasttarget = nil
- do
- --//=================================\\
- --|| SAZERENOS' ARTIFICIAL HEARTBEAT
- --\\=================================//
- ArtificialHB = Instance.new("BindableEvent", script)
- ArtificialHB.Name = "ArtificialHB"
- script:WaitForChild("ArtificialHB")
- frame = (1/60)
- tf = 0
- allowframeloss = false
- tossremainder = false
- lastframe = tick()
- script.ArtificialHB:Fire()
- game:GetService("RunService").Heartbeat:connect(function(s, p)
- tf = tf + s
- if tf >= frame then
- if allowframeloss then
- script.ArtificialHB:Fire()
- lastframe = tick()
- else
- for i = 1, math.floor(tf / frame) do
- script.ArtificialHB:Fire()
- end
- lastframe = tick()
- end
- if tossremainder then
- tf = 0
- else
- tf = tf - frame * math.floor(tf / frame)
- end
- end
- end)
- function Swait(NUMBER)
- if NUMBER == 0 or NUMBER == nil then
- ArtificialHB.Event:wait()
- else
- for i = 1, NUMBER do
- ArtificialHB.Event:wait()
- end
- end
- end
- --//=================================\\
- --\\=================================//
- local pf = Instance.new("Folder")
- pf.Parent = script
- local _s = 4
- local s = Vector3.new(_s,_s,_s)
- local observers = {}
- function create_ray(p1,p2,v)
- local r = workspace:FindPartOnRay(Ray.new(p1,(p2-p1).Unit*(_s+_s/2)),v)
- return r
- end
- function check(p)
- local r = false
- if p and string.match(p.Name:lower(),'block') then
- r = true
- end
- return r
- end
- local observersStatus = {}
- function create_observer(pos)
- local p = Instance.new("Part")
- p.Name = 'block'
- p.Color = Color3.fromRGB(255, 0, 85)
- p.Material = Enum.Material.SmoothPlastic
- p.Anchored = true
- p.CanCollide = true
- p.Locked = false
- p.Position = pos or Vector3.new()
- p.Size = Vector3.new(_s,_s,_s)
- p.Parent = pf
- local look2 = Instance.new("Handles")
- look2.Faces = Faces.new(Enum.NormalId.Front)
- look2.Color3 = Color3.fromRGB(255, 255, 0)
- look2.Adornee = p
- look2.Parent = p
- local back2 = Instance.new("Handles")
- back2.Faces = Faces.new(Enum.NormalId.Back)
- back2.Color3 = Color3.fromRGB(255, 0, 0)
- back2.Adornee = p
- back2.Parent = p
- local activated = Instance.new("BoolValue")
- activated.Name = 'active'
- activated.Value = false
- activated.Parent = p
- table.insert(observers,1,p)
- observersStatus[p] = {nil, tick(), nil}
- return p
- end
- function update_observers()
- for i,v in pairs(observers) do
- if v and v.Parent then
- local block = create_ray(v.CFrame.Position,v.CFrame.Position+v.CFrame.lookVector,v)
- if (check(block) == false) then
- block = nil
- end
- local status = observersStatus[v]
- if (block ~= status[1] or (block and status[4] ~= tostring(block.BrickColor))) then
- status[2] = tick()
- end
- status[1] = block
- if (block) then
- status[4] = tostring(block.BrickColor)
- end
- local actualStatus = tick()-status[2] < .1
- if (actualStatus == status[3]) then
- continue
- end
- status[3] = actualStatus
- if actualStatus then
- v.Color = Color3.fromRGB(0, 255, 85)
- else
- v.Color = Color3.fromRGB(255, 0, 85)
- end
- Swait()
- else
- table.remove(observers,i)
- observersStatus[v] = nil
- end
- end
- end
- --[[
- _G.check = function()
- local r = 0
- for i,v in pairs(observers) do r = r + 1 end
- return r
- end
- ]]
- end
- local blockfolder = workspace:FindFirstChild('blockfolder')
- if not blockfolder then
- blockfolder = Instance.new("Folder")
- blockfolder.Name = ('blockfolder')
- blockfolder.Parent = workspace
- end
- local mainGUI = Instance.new("ScreenGui")
- local Mode = Instance.new("Frame")
- local example = Instance.new("TextLabel")
- mainGUI.Name = "mainGUI"
- mainGUI.Parent = plr.PlayerGui
- Mode.Name = "Mode"
- Mode.Parent = mainGUI
- Mode.Position = UDim2.new(0, 0, 1, -40)
- Mode.Size = UDim2.new(1, 0, 0, 20)
- Mode.BackgroundColor = BrickColor.new("Dark grey metallic")
- Mode.BackgroundColor3 = Color3.new(0.352941, 0.352941, 0.352941)
- Mode.BackgroundTransparency = 1
- Mode.ZIndex = 10
- example.Name = "example"
- example.Parent = Mode
- example.Position = UDim2.new(0, 0, -2.3499999, 0)
- example.Visible = false
- example.Size = UDim2.new(1, 0, 2.5999999, 0)
- example.BackgroundColor = BrickColor.new("Institutional white")
- example.BackgroundColor3 = Color3.new(1, 1, 1)
- example.BackgroundTransparency = 1
- example.ZIndex = 10
- example.Font = Enum.Font.Code
- example.FontSize = Enum.FontSize.Size36
- example.Text = ""
- example.TextColor = BrickColor.new("Institutional white")
- example.TextColor3 = Color3.new(1, 1, 1)
- example.TextScaled = true
- example.TextSize = 36
- example.TextStrokeColor3 = Color3.new(0.745098, 0.745098, 0.745098)
- example.TextTransparency = 1
- example.TextWrap = true
- example.TextWrapped = true
- local block_properties = {
- ['S'] = 4,
- ["BlockSize"] = Vector3.new(4,4,4),
- }
- local blockdatas = ({
- ["Grass"]={
- ["Material"]=Enum.Material.Grass,
- ["BrickColor"]=BrickColor.new(52/255, 142/255, 64/255),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- ["Wood"]={
- ["Material"]=Enum.Material.WoodPlanks,
- ["BrickColor"]=BrickColor.new(218/255, 134/255, 122/255),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- ["Stone"]={
- ["Material"]=Enum.Material.Concrete,
- ["BrickColor"]=BrickColor.new(163/255, 162/255, 165/255),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- ["Glass"]={
- ["Material"]=Enum.Material.Glass,
- ["BrickColor"]=BrickColor.new("Institutional white"),
- ["Transparency"]=0.6,
- ["Reflectance"]=1,
- },
- ["Sand"]={
- ["Material"]=Enum.Material.Sand,
- ["BrickColor"]=BrickColor.new(255/255, 204/255, 153/255),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- ["Gravel"]={
- ["Material"]=Enum.Material.Pebble,
- ["BrickColor"]=BrickColor.new(99/255, 95/255, 98/255),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- ["Foil"]={
- ["Material"]=Enum.Material.Foil,
- ["BrickColor"]=BrickColor.new(1, 1, 1),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- ["Neon"]={
- ["Material"]=Enum.Material.Neon,
- ["BrickColor"]=BrickColor.new(1, 1, 1),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- ["Bedrock"]={
- ["Material"]=Enum.Material.Metal,
- ["BrickColor"]=BrickColor.new("Really black"),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- ["Observer"]={
- ["Material"]=Enum.Material.Metal,
- ["BrickColor"]=BrickColor.new("Really black"),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- }) --[blockType]
- local BlockReference = {}
- for i, v in pairs(blockdatas) do
- table.insert(BlockReference, i)
- local id = #BlockReference
- v.Id = id
- end
- for i,v in pairs(blockdatas) do
- totalblocks = totalblocks + 1
- end
- local colors = {
- 'Default',
- BrickColor.new("Institutional white"),
- BrickColor.new("Ghost grey"),
- BrickColor.new("Fossil"),
- BrickColor.new("Smoky grey"),
- BrickColor.new("Black"),
- BrickColor.new("Really black"),
- BrickColor.new("Really blue"),
- BrickColor.new("Really red"),
- BrickColor.new("Lime green"),
- BrickColor.new("Bright green"),
- BrickColor.new("Bright yellow"),
- BrickColor.new("New Yeller"),
- BrickColor.new("Bright orange"),
- BrickColor.new("Brown"),
- BrickColor.new("Royal purple"),
- BrickColor.new("Alder"),
- BrickColor.new("Cyan"),
- BrickColor.new("Pink"),
- BrickColor.new("Crimson"),
- BrickColor.new("Brown"),
- }
- local function Notify(text,amount)
- local textbox = example:Clone()
- textbox.Parent = example.Parent
- textbox.Text = text
- textbox.Visible = true
- spawn(function()
- game:GetService("TweenService"):Create(textbox,TweenInfo.new(0.25),{TextTransparency = 0}):Play()
- wait(amount)
- game:GetService("TweenService"):Create(textbox,TweenInfo.new(0.25),{TextTransparency = 1}):Play()
- game:GetService("Debris"):AddItem(textbox,0.25)
- end)
- return textbox
- end
- if currentnotify then
- currentnotify.Visible = false
- end
- currentnotify = Notify("Successfully loaded KrY's MC Build script!",3)
- function round(n)
- return ((n + 0.5) - (n + 0.5) % 1)
- end
- function checkcoords(pos)
- local canplace = true
- local r3 = Region3.new(pos-Vector3.new(5,5,5),pos+Vector3.new(5,5,5))
- local parts = workspace:FindPartsInRegion3WithWhiteList(r3,{blockfolder},1/0)
- for i,v in ipairs(parts) do
- if v:IsA("BasePart") and v:FindFirstChild("mcblock") and v.Position == pos then
- return false
- end
- end
- return true
- end
- function round(Num)
- return math.floor(Num + 0.5)
- end
- function place(pos,mag,ts,t)
- if t then else return end
- local largest = t.Size.X
- local cango = true
- local r3 = Region3.new(pos-Vector3.new(5,5,5),pos+Vector3.new(5,5,5))
- local ph = Instance.new("Part")
- local parts = workspace:FindPartsInRegion3(r3,ph,1/0)
- for i,v in ipairs(parts) do
- if v:IsA("BasePart") and v.Name == "Baseplate" and v:FindFirstChild("owner") then
- if v.owner.Value ~= plr and Vector2.new(pos.X-v.Position.X).magnitude < v.range.Value and Vector2.new(pos.Z-v.Position.Z).magnitude < v.range.Value then
- cango = false
- break
- elseif v.Position == pos then
- cango = false
- break
- end
- end
- end
- if t.Size.Y > largest then
- largest = t.Size.Y
- if t.Size.Z > largest then
- largest = t.Size.Z
- end
- end
- if 10 >= mag and cango then
- if t.Name == "Base" or t.Name == "Baseplate" then
- pos = Vector3.new(round(pos.X/block_properties.S)*block_properties.S,round(pos.Y/block_properties.S)*block_properties.S,round(pos.Z/block_properties.S)*block_properties.S) + Vector3.new(0,block_properties.BlockSize.Y/2,0)
- else
- if ts == "Top" then
- pos = t.CFrame * CFrame.new(0,block_properties.BlockSize.Y,0)
- elseif ts == "Left" then
- pos = t.CFrame * CFrame.new(-block_properties.BlockSize.X,0,0)
- elseif ts == "Right" then
- pos = t.CFrame * CFrame.new(block_properties.BlockSize.X,0,0)
- elseif ts == "Front" then
- pos = t.CFrame * CFrame.new(0,0,-block_properties.BlockSize.Z)
- elseif ts == "Back" then
- pos = t.CFrame * CFrame.new(0,0,block_properties.BlockSize.Z)
- elseif ts == "Bottom" then
- pos = t.CFrame * CFrame.new(0,-block_properties.BlockSize.Y,0)
- end
- pos = pos.Position;
- pos = Vector3.new(round(pos.X/block_properties.S)*block_properties.S,round(pos.Y/block_properties.S)*block_properties.S,round(pos.Z/block_properties.S)*block_properties.S) + Vector3.new(0,-block_properties.BlockSize.Y/2,0)
- end
- if checkcoords(pos) == true and cango then
- local block
- if (blockType == "Observer") then
- block = create_observer()
- block.Parent = blockfolder
- end
- block = block or Instance.new("Part",blockfolder)
- block.Name = "block"
- block.Size = block_properties.BlockSize
- block.Position = pos
- block.Orientation = rot
- block.Material = blockdatas[blockType]['Material']
- local bval = Instance.new("StringValue")
- bval.Name = 'blocktype'
- bval.Value = blockType
- bval.Parent = block
- local cval = Instance.new("NumberValue")
- cval.Name = 'colorid'
- cval.Value = colorid
- cval.Parent = block
- if colors[colorid] == 'Default' then
- block.BrickColor = blockdatas[blockType]['BrickColor']
- else
- block.BrickColor = colors[colorid]
- end
- block.Transparency = blockdatas[blockType]['Transparency']
- block.Reflectance = blockdatas[blockType]['Reflectance']
- block.Anchored = true
- block.CanCollide = true
- end
- end
- end
- function delete(pos,mag,ts,t)
- if t and t.Parent and ((string.match(t.Parent.Name,'blockfolder') and t.Parent:IsA("Folder")) or t:IsDescendantOf(blockfolder)) then
- t:Destroy()
- end
- end
- function change(pos,mag,ts,t)
- if t and t.Parent and ((string.match(t.Parent.Name,'blockfolder') and t.Parent:IsA("Folder")) or t:IsDescendantOf(blockfolder)) then
- blockType = t['blocktype'].Value
- colorid = t['colorid'].Value
- if currentnotify then
- currentnotify.Visible = false
- end
- currentnotify = Notify("Block: " ..blockType,2)
- end
- end
- local remote = Instance.new("RemoteEvent")
- remote.Parent = plr['PlayerGui']
- local sv = Instance.new("ObjectValue")
- sv.Name = 'script'
- sv.Value = script
- sv.Parent = remote
- ls = [[
- plr = game:GetService("Players").LocalPlayer
- mouse = plr:GetMouse()
- remote = script.Parent
- sv = remote:FindFirstChild("script").Value
- local last_data = {pos = Vector3.new(),mag = 0,'Front',nil}
- local blockType = 'Grass'
- local rot = Vector3.new()
- local colorid = 1
- local blockmode = 1
- local totalblocks = 0
- local selectmode = 1
- local currentnotify
- local preplace = nil
- local preplacepart = nil
- local highlight = nil
- local placing = true
- local lastmpos = nil
- local lasttarget = nil
- local block_properties = {
- ['S'] = 4,
- ["BlockSize"] = Vector3.new(4,4,4),
- }
- local blockdatas = ({
- ["Grass"]={
- ["Material"]=Enum.Material.Grass,
- ["BrickColor"]=BrickColor.new(52/255, 142/255, 64/255),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- ["Wood"]={
- ["Material"]=Enum.Material.WoodPlanks,
- ["BrickColor"]=BrickColor.new(218/255, 134/255, 122/255),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- ["Stone"]={
- ["Material"]=Enum.Material.Concrete,
- ["BrickColor"]=BrickColor.new(163/255, 162/255, 165/255),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- ["Glass"]={
- ["Material"]=Enum.Material.Glass,
- ["BrickColor"]=BrickColor.new("Institutional white"),
- ["Transparency"]=0.6,
- ["Reflectance"]=1,
- },
- ["Sand"]={
- ["Material"]=Enum.Material.Sand,
- ["BrickColor"]=BrickColor.new(255/255, 204/255, 153/255),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- ["Gravel"]={
- ["Material"]=Enum.Material.Pebble,
- ["BrickColor"]=BrickColor.new(99/255, 95/255, 98/255),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- ["Foil"]={
- ["Material"]=Enum.Material.Foil,
- ["BrickColor"]=BrickColor.new(1, 1, 1),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- ["Neon"]={
- ["Material"]=Enum.Material.Neon,
- ["BrickColor"]=BrickColor.new(1, 1, 1),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- ["Bedrock"]={
- ["Material"]=Enum.Material.Metal,
- ["BrickColor"]=BrickColor.new("Really black"),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- ["Observer"]={
- ["Material"]=Enum.Material.Metal,
- ["BrickColor"]=BrickColor.new("Really black"),
- ["Transparency"]=0,
- ["Reflectance"]=0,
- },
- }) --[blockType]
- local BlockReference = {}
- for i, v in pairs(blockdatas) do
- table.insert(BlockReference, i)
- local id = #BlockReference
- v.Id = id
- end
- for i,v in pairs(blockdatas) do
- totalblocks = totalblocks + 1
- end
- local blockfolder = workspace:FindFirstChild('blockfolder')
- local colors = {
- 'Default',
- BrickColor.new("Institutional white"),
- BrickColor.new("Ghost grey"),
- BrickColor.new("Fossil"),
- BrickColor.new("Smoky grey"),
- BrickColor.new("Black"),
- BrickColor.new("Really black"),
- BrickColor.new("Really blue"),
- BrickColor.new("Really red"),
- BrickColor.new("Lime green"),
- BrickColor.new("Bright green"),
- BrickColor.new("Bright yellow"),
- BrickColor.new("New Yeller"),
- BrickColor.new("Bright orange"),
- BrickColor.new("Brown"),
- BrickColor.new("Royal purple"),
- BrickColor.new("Alder"),
- BrickColor.new("Cyan"),
- BrickColor.new("Pink"),
- BrickColor.new("Crimson"),
- BrickColor.new("Brown"),
- }
- function update_build()
- if not blockfolder or not blockfolder.Parent then
- blockfolder = workspace:FindFirstChild('blockfolder')
- return
- end
- if placing then
- if not preplacepart or not preplacepart.Parent or not preplace or not preplace.Parent or not highlight or not highlight.Parent then
- if preplace then preplace:Destroy() end
- preplacepart = Instance.new("Part")
- preplace = Instance.new("BlockMesh")
- preplacepart.Parent = sv
- preplacepart.CFrame = CFrame.new(0,0,0)
- preplacepart.Transparency = 0.5
- preplacepart.Size = Vector3.new(0, 0, 0)
- preplacepart.Anchored = true
- preplacepart.CanCollide = false
- highlight = Instance.new("SelectionBox")
- highlight.Adornee = nil -- preplacepart
- highlight.LineThickness = 0.1
- highlight.Parent = preplacepart
- local BillboardGui0 = Instance.new("BillboardGui")
- local TextBox1 = Instance.new("TextBox")
- BillboardGui0.Parent = preplacepart
- BillboardGui0.Size = UDim2.new(0, 200, 1, 0)
- BillboardGui0.Active = true
- BillboardGui0.ClipsDescendants = true
- BillboardGui0.AlwaysOnTop = true
- TextBox1.Parent = BillboardGui0
- TextBox1.Size = UDim2.new(1, 0, 1, 0)
- TextBox1.BackgroundColor = BrickColor.new("Institutional white")
- TextBox1.BackgroundColor3 = Color3.new(1, 1, 1)
- TextBox1.BackgroundTransparency = 1
- TextBox1.BorderSizePixel = 0
- TextBox1.ZIndex = 2
- TextBox1.Font = Enum.Font.SourceSansBold
- TextBox1.FontSize = Enum.FontSize.Size14
- TextBox1.Text = plr.Name
- TextBox1.TextColor = BrickColor.new("Institutional white")
- TextBox1.TextColor3 = Color3.new(1, 1, 1)
- TextBox1.TextScaled = true
- TextBox1.TextSize = 14
- TextBox1.TextStrokeTransparency = 0
- TextBox1.TextWrap = true
- TextBox1.TextWrapped = true
- if selectmode == 1 then
- preplacepart.Material = blockdatas[blockType]['Material']
- if colors[colorid] == 'Default' then
- preplacepart.BrickColor = blockdatas[blockType]['BrickColor']
- else
- preplacepart.BrickColor = colors[colorid]
- end
- preplacepart.Reflectance = blockdatas[blockType]['Reflectance']
- highlight.Color3 = Color3.fromRGB(49, 255, 26)
- elseif selectmode == 2 then
- preplacepart.Material = Enum.Material.Neon
- preplacepart.BrickColor = BrickColor.new("Really red")
- highlight.Color3 = Color3.fromRGB(255, 0, 0)
- elseif selectmode == 3 then
- preplacepart.Material = Enum.Material.Neon
- preplacepart.BrickColor = BrickColor.new("New Yeller")
- highlight.Color3 = Color3.fromRGB(255, 255, 0)
- end
- preplace.Parent = preplacepart
- local S = block_properties.S*2*10
- preplace.Scale = Vector3.new(S,S,S)
- end
- --pcall(function()
- if preplacepart and preplacepart.Parent then
- local pos,mag,ts,t = last_data.pos,last_data.mag,last_data.ts,last_data.t
- if t then else return end
- local largest = t.Size.X
- local cango = true
- local r3 = Region3.new(pos-Vector3.new(5,5,5),pos+Vector3.new(5,5,5))
- local ph = Instance.new("Part")
- local parts = workspace:FindPartsInRegion3(r3,ph,1/0)
- for i,v in ipairs(parts) do
- if v:IsA("BasePart") and v.Name == "Baseplate" and v:FindFirstChild("owner") then
- if v.owner.Value ~= plr and Vector2.new(pos.X-v.Position.X).magnitude < v.range.Value and Vector2.new(pos.Z-v.Position.Z).magnitude < v.range.Value then
- cango = false
- break
- elseif v.Position == pos then
- cango = false
- break
- end
- end
- end
- if t.Size.Y > largest then
- largest = t.Size.Y
- if t.Size.Z > largest then
- largest = t.Size.Z
- end
- end
- if 10 >= mag and t ~= nil then
- local function round(Num)
- return math.floor(Num + 0.5)
- end
- if t.Name == "Base" or t.Name == "Baseplate" then
- pos = Vector3.new(round(pos.X/block_properties.S)*block_properties.S,round(pos.Y/block_properties.S)*block_properties.S,round(pos.Z/block_properties.S)*block_properties.S) + Vector3.new(0,block_properties.BlockSize.Y/2,0)
- else
- if ts == "Top" then
- pos = t.CFrame * CFrame.new(0,block_properties.BlockSize.Y,0)
- elseif ts == "Left" then
- pos = t.CFrame * CFrame.new(-block_properties.BlockSize.X,0,0)
- elseif ts == "Right" then
- pos = t.CFrame * CFrame.new(block_properties.BlockSize.X,0,0)
- elseif ts == "Front" then
- pos = t.CFrame * CFrame.new(0,0,-block_properties.BlockSize.Z)
- elseif ts == "Back" then
- pos = t.CFrame * CFrame.new(0,0,block_properties.BlockSize.Z)
- elseif ts == "Bottom" then
- pos = t.CFrame * CFrame.new(0,-block_properties.BlockSize.Y,0)
- end
- pos = pos.Position;
- pos = Vector3.new(round(pos.X/block_properties.S)*block_properties.S,round(pos.Y/block_properties.S)*block_properties.S,round(pos.Z/block_properties.S)*block_properties.S) + Vector3.new(0,-block_properties.BlockSize.Y/2,0)
- end
- if (selectmode == 2 or selectmode == 3) and ((string.match(t.Parent.Name,'blockfolder') and t.Parent:IsA("Folder")) or t:IsDescendantOf(blockfolder)) then
- preplacepart.Position = t.Position
- else
- preplacepart.Position = pos
- end
- preplacepart.Orientation = rot
- end
- end
- --end)
- end
- end
- mouse.KeyDown:Connect(function(key)
- local pos = mouse.Hit.p
- local mag = 0 -- (plr.Character.HumanoidRootPart.Position - pos).magnitude
- local ts = mouse.TargetSurface.Name
- local t = mouse.Target
- last_data = {pos = pos,mag = mag,ts = ts,t = t}
- if key == "q" or key == "e" then
- if placing then
- if key == 'e' and selectmode == 1 then
- if blockmode == totalblocks then
- blockmode = 1
- blockType = BlockReference[blockmode]
- if preplacepart then
- preplacepart.Material = blockdatas[blockType]['Material']
- preplacepart.BrickColor = blockdatas[blockType]['BrickColor']
- end
- else
- blockmode = blockmode + 1
- blockType = BlockReference[blockmode]
- if preplacepart then
- preplacepart.Material = blockdatas[blockType]['Material']
- preplacepart.BrickColor = blockdatas[blockType]['BrickColor']
- end
- end
- elseif key == 'q' and selectmode == 1 then
- if blockmode == 1 then
- blockmode = totalblocks
- blockType = BlockReference[blockmode]
- if preplacepart then
- preplacepart.Material = blockdatas[blockType]['Material']
- preplacepart.BrickColor = blockdatas[blockType]['BrickColor']
- end
- else
- blockmode = blockmode - 1
- blockType = BlockReference[blockmode]
- if preplacepart then
- preplacepart.Material = blockdatas[blockType]['Material']
- preplacepart.BrickColor = blockdatas[blockType]['BrickColor']
- end
- end
- end
- end
- remote:FireServer(last_data,2,key)
- end
- if key == "v" then
- placing = not placing
- if not placing then
- if preplace then
- preplace:Destroy()
- end
- if preplacepart then
- preplacepart:Destroy()
- end
- end
- remote:FireServer(last_data,3)
- end
- if key == "f" then
- if placing then
- selectmode = selectmode + 1
- if selectmode > 3 then
- selectmode = 1
- end
- if selectmode == 1 and preplacepart and preplacepart.Parent and highlight and highlight.Parent then
- preplacepart.Material = blockdatas[blockType]['Material']
- if colors[colorid] == 'Default' then
- preplacepart.BrickColor = blockdatas[blockType]['BrickColor']
- else
- preplacepart.BrickColor = colors[colorid]
- end
- preplacepart.Reflectance = blockdatas[blockType]['Reflectance']
- highlight.Color3 = Color3.fromRGB(49, 255, 26)
- elseif selectmode == 2 and preplacepart and preplacepart.Parent and highlight and highlight.Parent then
- if preplacepart.Parent then
- preplacepart.Material = Enum.Material.Neon
- preplacepart.BrickColor = BrickColor.new("Really red")
- highlight.Color3 = Color3.fromRGB(255, 0, 0)
- end
- elseif selectmode == 3 and preplacepart and preplacepart.Parent and highlight and highlight.Parent then
- if preplacepart.Parent then
- preplacepart.Material = Enum.Material.Neon
- preplacepart.BrickColor = BrickColor.new("New Yeller")
- highlight.Color3 = Color3.fromRGB(255, 255, 0)
- end
- end
- end
- remote:FireServer(last_data,4)
- end
- if key == "g" or key == "h" then
- if selectmode == 1 and placing then
- if key == 'g' then
- colorid = colorid - 1
- if 1 > colorid then
- colorid = #colors
- end
- elseif key == 'h' then
- colorid = colorid + 1
- if colorid > #colors then
- colorid = 1
- end
- end
- if colors[colorid] == 'Default' then
- preplacepart.BrickColor = blockdatas[blockType]['BrickColor']
- else
- preplacepart.BrickColor = colors[colorid]
- end
- end
- remote:FireServer(last_data,6,key)
- end
- if key == "r" or key == "t" or key == "y" then
- if selectmode == 1 and placing then
- if key == 't' then
- rot = rot + Vector3.new(90,0,0)
- elseif key == 'r' then
- rot = rot + Vector3.new(0,90,0)
- elseif key == 'y' then
- rot = rot + Vector3.new(0,0,90)
- end
- end
- remote:FireServer(last_data,7,key)
- end
- end)
- mouse.Button1Down:Connect(function()
- local pos = mouse.Hit.p
- local mag = 0 -- (plr.Character.HumanoidRootPart.Position - pos).magnitude
- local ts = mouse.TargetSurface.Name
- local t = mouse.Target
- last_data = {pos = pos,mag = mag,ts = ts,t = t}
- remote:FireServer(last_data,1)
- end)
- mouse.Button1Up:Connect(function()
- local pos = mouse.Hit.p
- local mag = 0 -- (plr.Character.HumanoidRootPart.Position - pos).magnitude
- local ts = mouse.TargetSurface.Name
- local t = mouse.Target
- last_data = {pos = pos,mag = mag,ts = ts,t = t}
- remote:FireServer(last_data,5)
- end)
- game:GetService("RunService").RenderStepped:Connect(function()
- local pos = mouse.Hit.p
- local mag = 0 -- (plr.Character.HumanoidRootPart.Position - pos).magnitude
- local ts = mouse.TargetSurface.Name
- local t = mouse.Target
- last_data = {pos = pos,mag = mag,ts = ts,t = t}
- update_build()
- remote:FireServer(last_data,0)
- end)
- ]]
- NLS(ls,remote)
- local last_data = {pos = Vector3.new(),mag = 0,'Front',nil}
- function update_build()
- if not blockfolder or not blockfolder.Parent then
- blockfolder = Instance.new("Folder")
- blockfolder.Name = ('blockfolder')
- blockfolder.Parent = workspace
- end
- if true then return end -- ignore the rest of the client sided code
- if placing then
- if not preplacepart or not preplacepart.Parent or not preplace or not preplace.Parent or not highlight or not highlight.Parent then
- if preplace then preplace:Destroy() end
- preplacepart = Instance.new("Part")
- preplace = Instance.new("BlockMesh")
- preplacepart.Parent = script
- preplacepart.CFrame = CFrame.new(0,0,0)
- preplacepart.Transparency = 0.5
- preplacepart.Size = Vector3.new(0, 0, 0)
- preplacepart.Anchored = true
- preplacepart.CanCollide = false
- highlight = Instance.new("SelectionBox")
- highlight.Adornee = nil -- preplacepart
- highlight.LineThickness = 0.1
- highlight.Parent = preplacepart
- local BillboardGui0 = Instance.new("BillboardGui")
- local TextBox1 = Instance.new("TextBox")
- BillboardGui0.Parent = preplacepart
- BillboardGui0.Size = UDim2.new(0, 200, 1, 0)
- BillboardGui0.Active = true
- BillboardGui0.ClipsDescendants = true
- BillboardGui0.AlwaysOnTop = true
- TextBox1.Parent = BillboardGui0
- TextBox1.Size = UDim2.new(1, 0, 1, 0)
- TextBox1.BackgroundColor = BrickColor.new("Institutional white")
- TextBox1.BackgroundColor3 = Color3.new(1, 1, 1)
- TextBox1.BackgroundTransparency = 1
- TextBox1.BorderSizePixel = 0
- TextBox1.ZIndex = 2
- TextBox1.Font = Enum.Font.SourceSansBold
- TextBox1.FontSize = Enum.FontSize.Size14
- TextBox1.Text = plr.Name
- TextBox1.TextColor = BrickColor.new("Institutional white")
- TextBox1.TextColor3 = Color3.new(1, 1, 1)
- TextBox1.TextScaled = true
- TextBox1.TextSize = 14
- TextBox1.TextStrokeTransparency = 0
- TextBox1.TextWrap = true
- TextBox1.TextWrapped = true
- if selectmode == 1 then
- preplacepart.Material = blockdatas[blockType]['Material']
- if colors[colorid] == 'Default' then
- preplacepart.BrickColor = blockdatas[blockType]['BrickColor']
- else
- preplacepart.BrickColor = colors[colorid]
- end
- preplacepart.Reflectance = blockdatas[blockType]['Reflectance']
- highlight.Color3 = Color3.fromRGB(49, 255, 26)
- elseif selectmode == 2 then
- preplacepart.Material = Enum.Material.Neon
- preplacepart.BrickColor = BrickColor.new("Really red")
- highlight.Color3 = Color3.fromRGB(255, 0, 0)
- elseif selectmode == 3 then
- preplacepart.Material = Enum.Material.Neon
- preplacepart.BrickColor = BrickColor.new("New Yeller")
- highlight.Color3 = Color3.fromRGB(255, 255, 0)
- end
- preplace.Parent = preplacepart
- local S = block_properties.S*2*10
- preplace.Scale = Vector3.new(S,S,S)
- end
- if preplacepart and preplacepart.Parent then
- local pos,mag,ts,t = last_data.pos,last_data.mag,last_data.ts,last_data.t
- if t then else return end
- local largest = t.Size.X
- local cango = true
- local r3 = Region3.new(pos-Vector3.new(5,5,5),pos+Vector3.new(5,5,5))
- local ph = Instance.new("Part")
- local parts = workspace:FindPartsInRegion3(r3,ph,1/0)
- for i,v in ipairs(parts) do
- if v:IsA("BasePart") and v.Name == "Baseplate" and v:FindFirstChild("owner") then
- if v.owner.Value ~= plr and Vector2.new(pos.X-v.Position.X).magnitude < v.range.Value and Vector2.new(pos.Z-v.Position.Z).magnitude < v.range.Value then
- cango = false
- break
- elseif v.Position == pos then
- cango = false
- break
- end
- end
- end
- if t.Size.Y > largest then
- largest = t.Size.Y
- if t.Size.Z > largest then
- largest = t.Size.Z
- end
- end
- if 10 >= mag and t ~= nil then
- local function round(Num)
- return math.floor(Num + 0.5)
- end
- if t.Name == "Base" or t.Name == "Baseplate" then
- pos = Vector3.new(round(pos.X/block_properties.S)*block_properties.S,round(pos.Y/block_properties.S)*block_properties.S,round(pos.Z/block_properties.S)*block_properties.S) + Vector3.new(0,block_properties.BlockSize.Y/2,0)
- else
- if ts == "Top" then
- pos = t.CFrame * CFrame.new(0,block_properties.BlockSize.Y,0)
- elseif ts == "Left" then
- pos = t.CFrame * CFrame.new(-block_properties.BlockSize.X,0,0)
- elseif ts == "Right" then
- pos = t.CFrame * CFrame.new(block_properties.BlockSize.X,0,0)
- elseif ts == "Front" then
- pos = t.CFrame * CFrame.new(0,0,-block_properties.BlockSize.Z)
- elseif ts == "Back" then
- pos = t.CFrame * CFrame.new(0,0,block_properties.BlockSize.Z)
- elseif ts == "Bottom" then
- pos = t.CFrame * CFrame.new(0,-block_properties.BlockSize.Y,0)
- end
- pos = pos.Position;
- pos = Vector3.new(round(pos.X/block_properties.S)*block_properties.S,round(pos.Y/block_properties.S)*block_properties.S,round(pos.Z/block_properties.S)*block_properties.S) + Vector3.new(0,-block_properties.BlockSize.Y/2,0)
- end
- if (selectmode == 2 or selectmode == 3) and ((string.match(t.Parent.Name,'blockfolder') and t.Parent:IsA("Folder")) or t:IsDescendantOf(blockfolder)) then
- preplacepart.Position = t.Position
- else
- preplacepart.Position = pos
- end
- preplacepart.Orientation = rot
- end
- end
- end
- end
- spawn(function()
- while remote do
- update_observers()
- update_build()
- wait()
- end
- script:Destroy()
- end)
- warn([[
- == CONTROLS ==
- Q or E - Change Block
- G or H - Change Color
- R,T,Y - Orientate Block
- F - Toggle Place,Break,EyeDropper
- V - Disable Building
- Click(Hold) - Place or Destroy
- ]])
- remote.OnServerEvent:Connect(function(lplr,data,mode,key)
- if plr == lplr then else return end
- if data then
- last_data = data
- end
- if mode == 1 and placing then
- clickid = clickid + 1
- _clickid = clickid
- holding = true
- if selectmode == 1 and blockfolder and blockfolder.Parent then
- place(last_data.pos,last_data.mag,last_data.ts,last_data.t)
- elseif selectmode == 2 --[[(preplace and preplacepart)]] then
- delete(last_data.pos,last_data.mag,last_data.ts,last_data.t)
- elseif selectmode == 3 then
- change(last_data.pos,last_data.mag,last_data.ts,last_data.t)
- end
- spawn(function()
- wait(0.1)
- while holding and (clickid == _clickid) do
- wait(0.1)
- if holding and (clickid == _clickid) then
- if selectmode == 1 and blockfolder and blockfolder.Parent then
- place(last_data.pos,last_data.mag,last_data.ts,last_data.t)
- elseif selectmode == 2 --[[(preplace and preplacepart)]] then
- delete(last_data.pos,last_data.mag,last_data.ts,last_data.t)
- elseif selectmode == 3 then
- change(last_data.pos,last_data.mag,last_data.ts,last_data.t)
- end
- end
- end
- end)
- elseif mode == 2 and placing then
- if key == 'e' and selectmode == 1 then
- if blockmode == totalblocks then
- blockmode = 1
- blockType = BlockReference[blockmode]
- if preplacepart then
- preplacepart.Material = blockdatas[blockType]['Material']
- preplacepart.BrickColor = blockdatas[blockType]['BrickColor']
- end
- else
- blockmode = blockmode + 1
- blockType = BlockReference[blockmode]
- if preplacepart then
- preplacepart.Material = blockdatas[blockType]['Material']
- preplacepart.BrickColor = blockdatas[blockType]['BrickColor']
- end
- if currentnotify then
- currentnotify.Visible = false
- end
- currentnotify = Notify("Block: " ..BlockReference[blockmode],2)
- end
- elseif key == 'q' and selectmode == 1 then
- if blockmode == 1 then
- blockmode = totalblocks
- blockType = BlockReference[blockmode]
- if preplacepart then
- preplacepart.Material = blockdatas[blockType]['Material']
- preplacepart.BrickColor = blockdatas[blockType]['BrickColor']
- end
- else
- blockmode = blockmode - 1
- blockType = BlockReference[blockmode]
- if preplacepart then
- preplacepart.Material = blockdatas[blockType]['Material']
- preplacepart.BrickColor = blockdatas[blockType]['BrickColor']
- end
- end
- if currentnotify then
- currentnotify.Visible = false
- end
- currentnotify = Notify("Block: " ..BlockReference[blockmode],2)
- end
- elseif mode == 3 then
- if currentnotify then
- currentnotify.Visible = false
- end
- placing = not placing
- if not placing then
- currentnotify = Notify("Mode: Disabled",2)
- else
- currentnotify = Notify("Mode: Enabled",2)
- end
- if not placing then
- if preplace then
- preplace:Destroy()
- end
- if preplacepart then
- preplacepart:Destroy()
- end
- end
- elseif mode == 4 and placing then
- selectmode = selectmode + 1
- if selectmode > 3 then
- selectmode = 1
- end
- if currentnotify then
- currentnotify.Visible = false
- end
- if selectmode == 1 then
- if preplacepart and preplacepart.Parent and highlight and highlight.Parent then
- preplacepart.Material = blockdatas[blockType]['Material']
- if colors[colorid] == 'Default' then
- preplacepart.BrickColor = blockdatas[blockType]['BrickColor']
- else
- preplacepart.BrickColor = colors[colorid]
- end
- preplacepart.Reflectance = blockdatas[blockType]['Reflectance']
- highlight.Color3 = Color3.fromRGB(49, 255, 26)
- end
- currentnotify = Notify("Mode: Place",2)
- elseif selectmode == 2 then
- if preplacepart and preplacepart.Parent and highlight and highlight.Parent then
- preplacepart.Material = Enum.Material.Neon
- preplacepart.BrickColor = BrickColor.new("Really red")
- highlight.Color3 = Color3.fromRGB(255, 0, 0)
- end
- currentnotify = Notify("Mode: Delete",2)
- elseif selectmode == 3 then
- if preplacepart and preplacepart.Parent and highlight and highlight.Parent then
- preplacepart.Material = Enum.Material.Neon
- preplacepart.BrickColor = BrickColor.new("New Yeller")
- highlight.Color3 = Color3.fromRGB(255, 255, 0)
- end
- currentnotify = Notify("Mode: EyeDropper",2)
- end
- elseif mode == 5 then
- holding = false
- clickid = clickid + 1
- elseif mode == 6 and selectmode == 1 and placing then
- if key == 'g' then
- colorid = colorid - 1
- if 1 > colorid then
- colorid = #colors
- end
- elseif key == 'h' then
- colorid = colorid + 1
- if colorid > #colors then
- colorid = 1
- end
- end
- if currentnotify then
- currentnotify.Visible = false
- end
- if preplacepart then
- if colors[colorid] == 'Default' then
- preplacepart.BrickColor = blockdatas[blockType]['BrickColor']
- else
- preplacepart.BrickColor = colors[colorid]
- end
- end
- currentnotify = Notify("Color: " ..tostring(colors[colorid]),2)
- elseif mode == 7 and selectmode == 1 and placing then
- if key == 't' then
- rot = rot + Vector3.new(90,0,0)
- elseif key == 'r' then
- rot = rot + Vector3.new(0,90,0)
- elseif key == 'y' then
- rot = rot + Vector3.new(0,0,90)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement