Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local toolbar = plugin:CreateToolbar("Demo")
- local button = toolbar:CreateButton("Top-down View", "Top-down view with limited movement", "rbxassetid://173741792")
- local active = false
- local camera
- local delta = 5
- _G.topDownPos = Vector3.new()
- local function update()
- camera.CFrame = CFrame.new(_G.topDownPos, _G.topDownPos - Vector3.new(0, 10, 0))
- end
- local mouse = plugin:GetMouse()
- mouse.KeyDown:Connect(function(key)
- key = key:lower()
- if (key == "a") then
- _G.topDownPos = _G.topDownPos + Vector3.new(-delta, 0, 0)
- update()
- elseif (key == "d") then
- _G.topDownPos = _G.topDownPos + Vector3.new(delta, 0, 0)
- update()
- elseif (key == "w") then
- _G.topDownPos = _G.topDownPos + Vector3.new(0, 0, -delta)
- update()
- elseif (key == "s") then
- _G.topDownPos = _G.topDownPos + Vector3.new(0, 0, delta)
- update()
- end
- end)
- button.Click:Connect(function()
- active = not active
- button:SetActive(active)
- camera = workspace.CurrentCamera
- camera.CameraType = active and "Scriptable" or "Custom"
- local p = camera.CFrame.p
- _G.topDownPos = Vector3.new(math.floor(p.X), math.floor(p.Y), math.floor(p.Z))
- update()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement