Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if game:GetService("RunService"):IsClient() then error("Please run as a server script. Use h/ instead of hl/.") end
- print("FE Compatibility: by WaverlyCole & Mokiros")
- InternalData = {}
- do
- script.Parent = owner.Character
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput"
- local function NewFakeEvent()
- local Fake = {fakeEvent=true,Connect=function(self,Func)self.Function=Func end}Fake.connect = Fake.Connect
- return Fake
- end
- local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
- local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
- local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
- self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
- end};ContextActionService.UnBindAction = ContextActionService.BindAction
- local function TriggerEvent(self,Event,...)
- local Trigger = Mouse[Event]
- if Trigger and Trigger.fakeEvent and Trigger.Function then
- Trigger.Function(...)
- end
- end
- Mouse.TrigEvent = TriggerEvent
- UserInputService.TrigEvent = TriggerEvent
- Event.OnServerEvent:Connect(function(FiredBy,Input)
- if FiredBy.Name ~= owner.Name then end
- if Input.MouseEvent then
- Mouse.Target = Input.Target
- Mouse.Hit = Input.Hit
- else
- local Begin = Input.UserInputState == Enum.UserInputState.Begin
- if Input.UserInputType == Enum.UserInputType.MouseButton1 then
- return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up")
- end
- for _,Action in pairs(ContextActionService.Actions) do
- for _,Key in pairs(Action.Keys) do
- if Key==Input.KeyCode then
- Action.Function(Action.Name,Input.UserInputState,Input)
- end
- end
- end
- Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower())
- UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false)
- end
- end)
- InternalData["Mouse"] = Mouse
- InternalData["ContextActionService"] = ContextActionService
- InternalData["UserInputService"] = UserInputService
- Event.Parent = NLS([[
- local Player = owner
- local Event = script:WaitForChild("UserInput")
- local UserInputService = game:GetService("UserInputService")
- local Mouse = Player:GetMouse()
- local Input = function(Input,gameProcessedEvent)
- if gameProcessedEvent then return end
- Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
- end
- UserInputService.InputBegan:Connect(Input)
- UserInputService.InputEnded:Connect(Input)
- local Hit,Target
- while wait(1/30) do
- if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
- Hit,Target = Mouse.Hit,Mouse.Target
- Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
- end
- end
- ]],owner.Character)
- end
- RealGame = game;game = setmetatable({},{
- __index = function (self,Index)
- local Sandbox = function (Thing)
- if Thing:IsA("Player") then
- local RealPlayer = Thing
- return setmetatable({},{
- __index = function (self,Index)
- local Type = type(RealPlayer[Index])
- if Type == "function" then
- if Index:lower() == "getmouse" or Index:lower() == "mouse" then
- return function (self)
- return InternalData["Mouse"]
- end
- end
- return function (self,...)
- return RealPlayer[Index](RealPlayer,...)
- end
- else
- if Index == "PlrObj" then
- return RealPlayer
- end
- return RealPlayer[Index]
- end
- end;
- __tostring = function(self)
- return RealPlayer.Name
- end
- })
- end
- end
- if RealGame[Index] then
- local Type = type(RealGame[Index])
- if Type == "function" then
- if Index:lower() == "getservice" or Index:lower() == "service" then
- return function (self,Service)
- if Service:lower() == "players" then
- return setmetatable({},{
- __index = function (self2,Index2)
- local RealService = RealGame:GetService(Service)
- local Type2 = type(Index2)
- if Type2 == "function" then
- return function (self,...)
- return RealService[Index2](RealService,...)
- end
- else
- if Index2:lower() == "localplayer" then
- return Sandbox(owner)
- end
- return RealService[Index2]
- end
- end;
- __tostring = function(self)
- return RealGame:GetService(Service).Name
- end
- })
- elseif Service:lower() == "contextactionservice" then
- return InternalData["ContextActionService"]
- elseif Service:lower() == "contextactionservice" then
- return InternalData["UserInputService"]
- elseif Service:lower() == "runservice" then
- return setmetatable({},{
- __index = function(self2,Index2)
- local RealService = RealGame:GetService(Service)
- local Type2 = type(Index2)
- if Type2 == "function" then
- return function (self,...)
- return RealService[Index2](RealService,...)
- end
- else
- if Index2:lower() == "bindtorenderstep" then
- return function (self,Name,Priority,Function)
- return RealGame:GetService("RunService").Stepped:Connect(Function)
- end
- end
- if Index2:lower() == "renderstepped" then
- return RealService["Stepped"]
- end
- return RealService[Index2]
- end
- end
- })
- else
- return RealGame:GetService(Service)
- end
- end
- end
- return function (self,...)
- return RealGame[Index](RealGame,...)
- end
- else
- if game:GetService(Index) then
- return game:GetService(Index)
- end
- return RealGame[Index]
- end
- else
- return nil
- end
- end
- });Game = game;owner = game:GetService("Players").LocalPlayer;script = {}
- print("Complete! Running...")
- me = game.Players.LocalPlayer
- char = me.Character
- hold = false
- thickness = 0.1
- maxt = 10
- bricks = {}
- color = BrickColor.new("Black")
- colors = {}
- for i=0,63,1 do
- table.insert(colors, BrickColor.palette(i))
- end
- function checkt()
- if thickness < 0.1 then
- thickness = 0.1
- end
- if thickness > maxt then
- thickness = maxt
- end
- end
- function makegui()
- local maxx = 200
- local x = 0
- local y = 0
- local g = Instance.new("ScreenGui")
- g.Name = "Colors"
- local fr = Instance.new("Frame",g)
- fr.Position = UDim2.new(0, 10, 0.3, 0)
- fr.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
- fr.BorderColor3 = Color3.new(0,0,0)
- local txt = nil
- local txt2 = nil
- local txt3 = nil
- for i,v in pairs(colors) do
- local gah = Instance.new("TextButton",fr)
- gah.Position = UDim2.new(0, x + 3, 0, y + 3)
- gah.Size = UDim2.new(0, 25, 0, 25)
- gah.BackgroundColor = v
- gah.BorderColor3 = Color3.new(0,0,0)
- gah.Text = ""
- gah.MouseButton1Down:connect(function()
- color = v
- txt.Text = v.Name
- end)
- gah.MouseEnter:connect(function()
- txt2.Text = v.Name
- end)
- gah.MouseLeave:connect(function() txt2.Text = ""
- end)
- x = x + 28
- if x >= maxx then
- x = 0
- y = y + 28
- end
- end
- fr.Size = UDim2.new(0, maxx + 27, 0, y + 40)
- txt = Instance.new("TextLabel",fr)
- txt.Size = UDim2.new(0.95, 0, 0, 35)
- txt.Position = UDim2.new(0.025, 0, 0, y + 3)
- txt.Text = color.Name
- txt.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)
- txt.BorderColor3 = Color3.new(0, 0, 0)
- txt.TextColor3 = Color3.new(1, 1, 1)
- txt.FontSize = "Size24"
- txt.Font = "ArialBold"
- txt.TextYAlignment = "Bottom"
- txt.TextXAlignment = "Left"
- txt2 = Instance.new("TextLabel",txt)
- txt2.Size = UDim2.new(1, 0, 0, 0)
- txt2.Text = color.Name
- txt2.BackgroundTransparency = 1
- txt2.TextColor3 = Color3.new(1, 1, 1)
- txt2.FontSize = "Size12"
- txt2.TextYAlignment = "Top"
- txt2.TextXAlignment = "Right"
- txt3 = Instance.new("TextLabel",fr)
- txt3.Size = UDim2.new(0.5, 0, 0, 25)
- txt3.Position = UDim2.new(0.25, 0, 1, 0)
- txt3.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)
- txt3.BorderColor3 = Color3.new(0,0,0)
- txt3.TextColor3 = Color3.new(1,1,1)
- txt3.FontSize = "Size12"
- txt3.Text = thickness
- g.Parent = me.PlayerGui
- coroutine.resume(coroutine.create(function()
- while g.Parent ~= nil do
- txt3.Text = thickness
- wait()
- end
- end))
- end
- function remgui()
- for i,v in pairs(me.PlayerGui:children()) do
- if v.Name == "Colors" then v:remove() end
- end
- end
- if script.Parent.className ~= "HopperBin" then
- h = Instance.new("HopperBin",me.Backpack)
- h.Name = "Draw"
- script.Parent = h
- end
- bin = script.Parent
- function weld(p1, p2)
- local w = Instance.new("Weld")
- w.Part0 = p2
- w.Part1 = p1
- w.C0 = p2.CFrame:toObjectSpace(p1.CFrame)
- w.Parent = p2
- end
- function B1D(mouse)
- hold = true
- coroutine.resume(coroutine.create(function()
- mouse.Button1Up:wait()
- hold = false
- end))
- local p = Instance.new("Part",char)
- p.formFactor = "Custom"
- p.Size = Vector3.new(1,0.5,0.5)
- p.Anchored = true
- p.TopSurface = 0
- p.BottomSurface = 0
- p.CanCollide = false
- p.BrickColor = color
- p.Locked = true
- local m = Instance.new("BlockMesh",p)
- local targ = mouse.Target
- table.insert(bricks, p)
- local pos = mouse.Hit.p
- while hold do
- local mag = (pos - mouse.Hit.p).magnitude
- m.Scale = Vector3.new(thickness, 0.4, (mag+(thickness/3))*2)
- p.CFrame = CFrame.new(pos, mouse.Hit.p) * CFrame.new(0, 0, -mag/2 - thickness/5)
- if mag > thickness/2+0.1 then
- B1D(mouse)
- if targ ~= nil then
- if targ.Anchored == false then
- p.Anchored = false
- weld(p, targ)
- end
- end
- break
- end
- wait()
- end
- end
- bin.Selected:connect(function(mouse)
- makegui()
- mouse.KeyDown:connect(function(key)
- key = key:lower()
- local kh = true
- coroutine.resume(coroutine.create(function()
- mouse.KeyUp:wait()
- kh = false
- end))
- if key == "q" then
- while kh do
- thickness = thickness - 0.1
- checkt()
- wait()
- end
- elseif key == "e" then
- while kh do
- thickness = thickness + 0.1
- checkt()
- wait()
- end
- elseif key == "z" then
- while kh do
- if #bricks > 0 then
- bricks[#bricks]:remove()
- table.remove(bricks, #bricks)
- end
- wait()
- end
- elseif key == "f" then
- for i = #bricks, 1, -1 do
- bricks[i]:remove()
- table.remove(bricks, i)
- end
- end
- end)
- mouse.Button1Down:connect(function()
- B1D(mouse)
- end)
- end)
- bin.Deselected:connect(function()
- remgui()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement