I was playing Minecraft and I had an idea of a placement system. But I am stumped.
Problem: When placing blocks and the side of other blocks the go inside each other.
Sample Code:
01 | local Player = game.Players.LocalPlay |
02 | local mos = Player:GetMouse() |
03 | local part = workspace.Part |
04 | local place = game.replicatedstorage.place |
05 |
06 | mos.Move:connect( function () |
07 | Part.Position = mouse.Hit.p |
08 | end ) |
09 |
10 | mouse.Clicked:Connect( function () --i know this dosnt work it will just give error. my place got corrupted so i have to remember all code |
11 | palce:FireServer(mouse.Hit.p) |
12 | end ) |
The code isnt perfect but i have to type directly into the question box.
If you could help that would be AWSOME
Idk how to make grid tho... Insert a remote event to replicatedstorage. Then insert a server script in serverscript servicescriptservice. Then type this in the serverscript :
1 | game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect( function (Player, MousePos) |
2 | local Part = Instance.new( "Part" ,workspace) |
3 | Part.Material = "Grass" |
4 | Part.Position = MousePos |
5 | Part.Anchored = true -- set it to true or false your choice |
6 | Part.Size = Vector 3. new( 5 , 5 , 5 ) |
7 | end ) |
then insert a local script to StarterPlayerScripts or StarterGui or StarterPack
then write this in the local script:
1 | local Mouse = game.Players.LocalPlayer:GetMouse() |
2 |
3 | Mouse.Button 1 Down:Connect( function () |
4 | game.ReplicatedStorage.RemoteEvent:FireServer(Mouse.Hit.Position) |
5 | end ) |
I havent tested it yet tho Hope it helped :-)