How do I make my mouse move in build mode, as I made a build mode system like bloxburg, but I can't use my mouse to look around in the grid. How do I do that?
local TweenService = game:GetService("TweenService") local UIS = game:GetService("UserInputService") local RunService = game:GetService("RunService")
local CM = false local P local W, A, S, D, E, Q, UA, LA, DA, RA = false, false, false, false, false, false, false, false, false, false
RunService.RenderStepped:Connect(function() if CM then if W then workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame + Vector3.new(-.3,0,0) end
if A then
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame + Vector3.new(0,0,.3)
end
if S then
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame + Vector3.new(.3,0,0)
end
if D then
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame + Vector3.new(0,0,-.3)
end
if E then
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame + Vector3.new(0,.3,0)
end
if Q then
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame + Vector3.new(0,-.3,0)
end
--[[if UA then
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(math.rad(3), 0, 0)
end]]
if LA then
P.Camera.Orientation = P.Camera.Orientation + Vector3.new(0, math.rad(3), 0)
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(0, math.rad(3), 0)
end
--[[if DA then
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(-math.rad(3), 0, 0)
end]]
if RA then
P.Camera.Orientation = P.Camera.Orientation + Vector3.new(0, -math.rad(3), 0)
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(0, -math.rad(3), 0)
end
end
end)
function InputBegan(K) if K.KeyCode == Enum.KeyCode.W then W = true end if K.KeyCode == Enum.KeyCode.A then A = true end if K.KeyCode == Enum.KeyCode.S then S = true end if K.KeyCode == Enum.KeyCode.D then D = true end
if K.KeyCode == Enum.KeyCode.E then
E = true
end
if K.KeyCode == Enum.KeyCode.Q then
Q = true
end
if K.KeyCode == Enum.KeyCode.Up then
UA = true
end
if K.KeyCode == Enum.KeyCode.Left then
LA = true
end
if K.KeyCode == Enum.KeyCode.Down then
DA = true
end
if K.KeyCode == Enum.KeyCode.Right then
RA = true
end
end
function InputEnded(K) if K.KeyCode == Enum.KeyCode.W then W = false end if K.KeyCode == Enum.KeyCode.A then A = false end if K.KeyCode == Enum.KeyCode.S then S = false end if K.KeyCode == Enum.KeyCode.D then D = false end
if K.KeyCode == Enum.KeyCode.E then
E = false
end
if K.KeyCode == Enum.KeyCode.Q then
Q = false
end
if K.KeyCode == Enum.KeyCode.Up then
UA = false
end
if K.KeyCode == Enum.KeyCode.Left then
LA = false
end
if K.KeyCode == Enum.KeyCode.Down then
DA = false
end
if K.KeyCode == Enum.KeyCode.Right then
RA = false
end
end
UIS.InputEnded:Connect(InputEnded) UIS.InputBegan:Connect(InputBegan)
function DrawGrid(Offset, Size, Thikness, Surface, Animtion, AnimationTime) print("Drawing Grid")
local FinalSizeX = (Size.X / Offset)
local FinalSizeZ = (Size.Z / Offset)
local XLines = {}
local ZLines = {}
for X = 1, FinalSizeX do
-- Draw
local LineX = Instance.new("Frame", Surface)
table.insert(XLines, LineX)
LineX.Name = "Line-X-" .. X
LineX.Size = UDim2.new(0,Thikness,1,0)
LineX.Position = UDim2.new(((X * Offset) / Size.X),0,0,0)
-- Appearance
LineX.BorderSizePixel = 0
LineX.BackgroundColor3 = Color3.fromRGB(255,255,255)
end
for Z = 1, FinalSizeZ do
-- Draw
local LineZ = Instance.new("Frame", Surface)
table.insert(ZLines, LineZ)
LineZ.Name = "Line-Z-" .. Z
LineZ.Size = UDim2.new(1,0,0,Thikness)
LineZ.Position = UDim2.new(0,0,((Z * Offset) / Size.Z), 0)
-- Appearance
LineZ.BorderSizePixel = 0
LineZ.BackgroundColor3 = Color3.fromRGB(255,255,255)
end
-- Animtion
if Animtion then
for _, Line in pairs(XLines) do
Line.Size = UDim2.new(0,0,0,0)
end
for _, Line in pairs(ZLines) do
Line.Size = UDim2.new(0,0,0,0)
end
for _, Line in pairs(XLines) do
Line.Size = UDim2.new(0,0,0,0)
local Info = TweenInfo.new(AnimationTime)
TweenService:Create(Line, Info, {Size = UDim2.new(0,Thikness,1,0)}):Play()
end
wait(AnimationTime / 2)
for _, Line in pairs(ZLines) do
Line.Size = UDim2.new(0,0,0,0)
local Info = TweenInfo.new(AnimationTime)
TweenService:Create(Line, Info, {Size = UDim2.new(1,0,0,Thikness)}):Play()
end
end
end
function DrawWall(Plot) game.ReplicatedStorage.Events.DrawSecretWall:FireServer(Plot)
wait(.1)
for _, O in pairs(Plot:GetChildren()) do
if O.Name == "Wall" then
O.Transparency = 1
O.CanCollide = false
end
end
end
function MoveCamera(Plot, Animation, AnimationTime) if Animation then local Info = TweenInfo.new(AnimationTime)
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
TweenService:Create(workspace.CurrentCamera, Info, {CFrame = Plot.Camera.CFrame}):Play()
else
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CFrame = Plot.Camera.CFrame
end
end
function MoveCharacter(Plot, Character) Character:SetPrimaryPartCFrame(Plot.Spawn.CFrame + Vector3.new(0,5,0)) end
local Module = {}
function Module:Stop(Plot, Player) CM = false
for _, O in pairs(Plot.Ground.Grid:GetChildren()) do
O:Destroy()
end
game.ReplicatedStorage.Events.RemoveSecretWall:FireServer(Plot)
workspace.CurrentCamera.CameraType = Enum.CameraType.Follow
local Movement = require(Player.PlayerScripts.PlayerModule):GetControls()
Movement:Enable()
end
function Module:Start(Plot, GridOffset, GridThikness, Animation, AnimationTime, Character, Player) CM = true P = Plot
DrawGrid(GridOffset, Plot.Ground.Size, GridThikness, Plot.Ground.Grid, Animation, AnimationTime)
DrawWall(Plot)
MoveCamera(Plot, Animation, AnimationTime)
MoveCharacter(Plot, Character)
local Movement = require(Player.PlayerScripts.PlayerModule):GetControls()
Movement:Disable()
end
return Module
