Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --CFrame.new(workspace.Camera.CFrame.Position+(workspace.Camera.CFrame.LookVector*10)) //VOID// use raycast
- local Toolbar = plugin:CreateToolbar("Building pack use")
- local PackSetButton = Toolbar:CreateButton("Set pack","Sets pack to use","rbxthumb://type=Avatar&id=1459338293&w=720&h=720")
- local PackToggleButton = Toolbar:CreateButton("Toggle pack","toggle 1 - 0 keys ","rbxthumb://type=Avatar&id=81951343&w=720&h=720")
- local PackClearButton = Toolbar:CreateButton("Clear pack","remove pack","rbxthumb://type=Avatar&id=1&w=720&h=720")
- local pack = {}
- local Selection = game:GetService("Selection")
- local connections = {}
- local numsAsWords = {
- [1] = Enum.KeyCode.One,
- [2] = Enum.KeyCode.Two,
- [3] = Enum.KeyCode.Three,
- [4] = Enum.KeyCode.Four,
- [5] = Enum.KeyCode.Five,
- [6] = Enum.KeyCode.Six,
- [7] = Enum.KeyCode.Seven,
- [8] = Enum.KeyCode.Eight,
- [9] = Enum.KeyCode.Nine,
- [0] = Enum.KeyCode.Zero,
- }
- local params = RaycastParams.new()
- function raycast(origin, direction)
- local result = game:GetService("StudioService"):GizmoRaycast(origin,(direction).unit*999)
- if result then
- return result.Position
- else
- print("NOT HIT")
- end
- end
- function getPlacePos(camera)
- local posz = raycast(camera.CFrame.Position,(camera.CFrame.Position-camera.CFrame.LookVector))
- return posz
- end
- function clearKeybinds()
- for i,v in pairs(connections) do
- v:disconnect()
- end
- end
- PackSetButton.Click:Connect(function()
- clearKeybinds()
- local selected = Selection:Get()
- for i=1,10 do
- pack[i] = selected[i]
- end
- end)
- PackClearButton.Click:Connect(function()
- pack = {}
- clearKeybinds()
- end)
- PackToggleButton.Click:Connect(function()
- for i=1,10 do
- connections[i] = game:GetService("UserInputService").InputBegan:Connect(function(k, r)
- if k.KeyCode == numsAsWords[i] then
- local obj = pack[i]:Clone()
- local position = getPlacePos(workspace.Camera)
- obj.Position = position
- obj.Parent = workspace
- end
- end)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement