SHARE
TWEET

Roblox top-down view plugin

a guest Sep 15th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local toolbar = plugin:CreateToolbar("Demo")
  2. local button = toolbar:CreateButton("Top-down View", "Top-down view with limited movement", "rbxassetid://173741792")
  3.  
  4. local active = false
  5. local camera
  6. local delta = 5
  7.  
  8. _G.topDownPos = Vector3.new()
  9.  
  10. local function update()
  11.     camera.CFrame = CFrame.new(_G.topDownPos, _G.topDownPos - Vector3.new(0, 10, 0))
  12. end
  13.  
  14. local mouse = plugin:GetMouse()
  15.  
  16. mouse.KeyDown:Connect(function(key)
  17.     key = key:lower()
  18.     if (key == "a") then
  19.         _G.topDownPos = _G.topDownPos + Vector3.new(-delta, 0, 0)
  20.         update()
  21.     elseif (key == "d") then
  22.         _G.topDownPos = _G.topDownPos + Vector3.new(delta, 0, 0)
  23.         update()
  24.     elseif (key == "w") then
  25.         _G.topDownPos = _G.topDownPos + Vector3.new(0, 0, -delta)
  26.         update()
  27.     elseif (key == "s") then
  28.         _G.topDownPos = _G.topDownPos + Vector3.new(0, 0, delta)
  29.         update()
  30.     end
  31. end)
  32.  
  33. button.Click:Connect(function()
  34.     active = not active
  35.     button:SetActive(active)
  36.     camera = workspace.CurrentCamera
  37.     camera.CameraType = active and "Scriptable" or "Custom"
  38.     local p = camera.CFrame.p
  39.     _G.topDownPos = Vector3.new(math.floor(p.X), math.floor(p.Y), math.floor(p.Z))
  40.     update()
  41. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top