#Grid building system override
94 messages · Page 1 of 1 (latest)
Placement.Snap = function(n)
return math.round(n / grid_size) * grid_size
end
local TS = game:GetService("TweenService")
Placement.GetPos = function()
if obj and obj.Parent == placedobj and grid_size then
PosX = Placement.Snap(mouse.Hit.X)
PosY = Placement.Snap(mouse.Hit.Y) + obj.Size.Y / 2
PosZ = Placement.Snap(mouse.Hit.Z)
else
PosX = mouse.Hit.X
PosY = mouse.Hit.Y
PosZ = mouse.Hit.Z
end
end
these are the snap and getpos functions
Placement.Place = function()
if CanPlace == true and checkCooldown == false and obj then
checkCooldown = true
if obj.Parent == placedobj then
game.ReplicatedStorage.pobj:FireServer(objname, PosX, PosY, PosZ, mouse.Hit)
obj:Destroy()
else
obj:Destroy()
end
Placement.New(cooldown, objname, itemfolder, placedobj, grid_size)
task.wait(cooldown)
checkCooldown = false
end
end
this is the place function
im really confused
alright
but its kinda wrongly placed
if i floor it
and well the problem still persists
Oh yeah bout that
anyone?
bro just followed b ricey's codes 💀
i took inspiration
copy*
ok
also no its not him anyways
** You are now Level 9! **
nice then
same
i ong have no idea how to fix it
uhhh idk how to explain it
i know the fix but
😭
just uhm
i have a feeling that
im doing the client-to-server wrong
just tell me please
please
just tell me whats wrong
not the code
just whats wrong
i tried region3d, i tried firing the stuff from the server, i tried using tables, i tried using raycasts, i tried using collission groups I DONT KNOW WHATS WRONG
@drowsy pumice
yeah, and also horizontal building
if i tried to make a bridge (like minecraft), they would stack up on the same block
you dont do any of that
you do this
u get .Mouse
u get its target
u check if its a block
yeah
.surface?
Mouse.TargetSurface
then according to that
u render the new block
in the position off the old block
offset with the surface offset value
one second
sorry for the messy code
elseif Target.Parent.Name == "BuildContainer" then
OutOfBounds = false
if Mouse.TargetSurface == Enum.NormalId.Front then
RB.Position = Target.Position + Vector3.new(0,0,-3.5)
elseif Mouse.TargetSurface == Enum.NormalId.Back then
RB.Position = Target.Position + Vector3.new(0,0,3.5)
elseif Mouse.TargetSurface == Enum.NormalId.Left then
RB.Position = Target.Position + Vector3.new(-3.5,0,0)
elseif Mouse.TargetSurface == Enum.NormalId.Right then
RB.Position = Target.Position + Vector3.new(3.5,0,0)
elseif Mouse.TargetSurface == Enum.NormalId.Top then
RB.Position = Target.Position + Vector3.new(0,3.5,0)
elseif Mouse.TargetSurface == Enum.NormalId.Bottom then
RB.Position = Target.Position + Vector3.new(0,-3.5,0)
end
RB.Parent = BuildSpace
that basically
then
when the player clicks
yeah
u send the proper offset position to server
the server checks if u can place a block there
if its valid
the server places the block
not the client
unless u want to
keep the blocks hidden from other clients
dont mind the 3.5
its just ur block size
so the size?
and then i recheck again all of that in the server?
ITS STILL NOT WORKING
no
maybeee its because the parent of the obj is being set in the server