Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How to code some sort of road building system, like Sim City or Skylines?

Asked by 6 years ago

How to make a click, drag, and build road system, or click at one position and drag the mouse to another until the mouse button is up, creating a road between the two roads. The roads can also be connected to other roads.

Anything could help, like something in the wiki or i'll just put some money in a scripter to do it.

0
plugins my b AttentionHog 70 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Even though this is kind of a request I will try to give you hints to make this. REMEMBER THAT THIS IS NOT FOR FE, THIS IS JUST AN EXAMPLE

First, make a model of something and then use the mouse .Move event.

local model = workspace.Model
local mouse = game.Players.LocalPlayer:GetMouse()

mouse.Move:Connect(function()
    if mouse.Hit.p ~= nil then
        model:MoveTo(mouse.Hit.p + Vector3.new(0,5,0))
        -- or you can use this
        model:SetPrimaryPartCFrame(mouse.Hit.p + + Vector3.new(0,5,0))
    end
end)

And for the clicking, there are many ways to do this, in this case I will clone it.

mouse.Button1Down:Connect(function()
    local new = model:Clone()
    new.Parent = workspace -- or anywhere you want
    new:MoveTo(mouse.Hit.p + Vector3.new(0,5,0))
    -- or
    new:SetPrimaryPartCFrame(mouse.Hit.p + + Vector3.new(0,5,0))
end)

If you want the model to be transparent before placing then, do it yourself, it's easy, use for loops to scan through parts

For the other things, try to search it yourself or learn from a free model

Ad

Answer this question