Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This script has been converted to FE by iPxter
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,Mouse,mouse,UserInputService,ContextActionService = owner
- do
- print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
- script.Parent = Player.Character
- --RemoteEvent for communicating
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- --Fake event to make stuff like Mouse.KeyDown work
- local function fakeEvent()
- local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
- t.connect = t.Connect
- return t
- end
- --Creating fake input objects with fake variables
- local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function te(self,ev,...)
- local t = m[ev]
- if t and t._fakeEvent and t.Function then
- t.Function(...)
- end
- end
- m.TrigEvent = te
- UIS.TrigEvent = te
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=Player then return end
- if io.isMouse then
- m.Target = io.Target
- m.Hit = io.Hit
- else
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return m:TrigEvent(b and "Button1Down" or "Button1Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[
- local Player = game:GetService("Players").LocalPlayer
- local Event = script:WaitForChild("UserInput_Event")
- local UIS = game:GetService("UserInputService")
- local input = function(io,a)
- if a then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local Mouse = Player:GetMouse()
- local h,t
- --Give the server mouse data 30 times every second, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- while wait(1/30) do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- end]==],Player.Character)
- Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
- end
- me = owner
- 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