Я немного новичок в кодировании на lua, и в настоящее время я пытаюсь создать игру, в которой 4 команды строят базу за определенное время, а затем сражаются. И хотя я смог сделать так, чтобы игрок мог строить, нет грид-системы, и все команды используют один и тот же инструмент.
Итак, мой вопрос: как мне создать «инструмент сборки», который позволяетигроки строить с сеткой? Мне также нужно как-то сделать так, чтобы соответствующая команда могла строить только на своей соответствующей платформе.
И, если возможно, «призрачный блок», который показывает, где игрок собирается разместить блок.
Это код, который я получил до сих пор для комплекта сборки:
-- all of this is in a localscript inside of the hammer tool
local players = game:GetService("Players")
local hammer = script.Parent -- the hammer tool that will make the player know they are in “building mode”
local player = game.Players.LocalPlayer
local mouse = player:GetMouse() -- get the mouse from the player
local function placeBlock(Part)
local position = mouse.Hit.p -- the position of the mouse so i can place blocks there
local buildingBrickRed = Instance.new("Part") -- creates a part that the player will place
buildingBrickRed.Parent = workspace
buildingBrickRed.BrickColor = BrickColor.new("Really red") -- makes the brick red
buildingBrickRed.Size = Vector3.new(5, 5, 5) -- sets the size of the block
buildingBrickRed.CFrame = CFrame.new(position) -- sets the position of the block to be where the mouse is
end
hammer.Activated:Connect(placeBlock) -- connects to the function when the player activates the tool