Need help with making a script, where, if you place blocks, other players can see it

There are no errors in OutPut, and it shows in it’s parent, and the transperancy is 0, but i can’t see it in the game.

What do you mean by that? Could you specify a little more?

Is the position the same? Enter as a server and check it please

1 Like

The position is the same in server and client.

I meant that you forgot to delete the shadow_block ( Gonna say, I don’t sure bout this one ) :

tool.Activated:Connect(function()
	if tool:FindFirstAncestorWhichIsA('Model') == player.Character then
		remoteEvent:FireServer("blueBlock", shadow_block.Position)
		-- wher delet?
		print("script is working")
	end
end)
1 Like

sorry, but i dont know what yoy mean by that?

Then everything is working correctly, how can you not see it?..

Ah yes forgetting to read the code before answer is the best thing I had ever done ( No it isn’t ), well first of all I read your code and turn out you were going to reuse the shadow_block and secondly, well there’s actually no secondly

1 Like

I don’t know man, I’ll show scripts again:
local script in the tool:

                                 ---------------------------------------------VARIBLES-------------------------------------------------
local remoteEvent = game.ReplicatedStorage:WaitForChild("BuildingSystemEvent")
local runService = game:GetService("RunService")
local tool = script.Parent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local grid = 1.5
local blueBlock = game.ReplicatedStorage:WaitForChild("BlueBlock")
local shadow_block = blueBlock:Clone(); shadow_block.Transparency = .5; shadow_block.Parent = workspace.Blocks.ShadowBlocks; shadow_block.CanCollide = false
if shadow_block.CanCollide == true then
	print("BRUH")
end

mouse.TargetFilter = shadow_block

                                ---------------------------------------------FUNCTIONS-------------------------------------------------

function snapToGrid(x)
	return math.floor(x/grid + 0.5)*grid
end

function calculateY(toP, toS, oS)
	return (toP + toS * 0.5) + oS * 0.5
end

runService.RenderStepped:Connect(function()
	if mouse.Target ~= nil then
		shadow_block.Position = Vector3.new(snapToGrid(mouse.Hit.Position.X), calculateY(mouse.Target.Position.Y, mouse.Target.Size.Y, blueBlock.Size.Y), snapToGrid(mouse.Hit.Position.Z))
	end
end)

tool.Activated:Connect(function()
	if tool:FindFirstAncestorWhichIsA('Model') == player.Character then
		remoteEvent:FireServer("blueBlock", shadow_block.Position)
		print("script is working")
	end
end)
runService.RenderStepped:Connect(function()
	if tool:FindFirstAncestorWhichIsA("Model") ~= player.Character then
		shadow_block.Transparency = 1
	end
end)
runService.RenderStepped:Connect(function()
	if tool:FindFirstAncestorWhichIsA("Model") == player.Character then
		shadow_block.Transparency = 0.5
	end
end)

script inside serverscriptservice:

ocal remoteEvent = game.ReplicatedStorage:WaitForChild("BuildingSystemEvent")

remoteEvent.OnServerEvent:Connect(function(player, block, position)

local clone = game.ReplicatedStorage:WaitForChild("BlueBlock"):Clone()

clone.Parent = workspace.Blocks.BlueBlocks

clone.Position = Vector3.new(position)

end)

Yes, i am trying to reuse the shadow_block variable.

Why are you using two RenderStepped instead of one, can you just make it like this?

runService.RenderStepped:Connect(function()
	if tool:FindFirstAncestorWhichIsA("Model") ~= player.Character then
		shadow_block.Transparency = 1
	else
		shadow_block.Transparency = .5
	end
end)

Edit : Forgot to add “?” lol

1 Like

I changed it, error still occurs.

Read your code again and turn out its aren’t two RenderStepped but three, well it’s simple fix :

runService.RenderStepped:Connect(function()
	if mouse.Target ~= nil then
		shadow_block.Position = Vector3.new(snapToGrid(mouse.Hit.Position.X), calculateY(mouse.Target.Position.Y, mouse.Target.Size.Y, blueBlock.Size.Y), snapToGrid(mouse.Hit.Position.Z))
	end
	
	if tool:FindFirstAncestorWhichIsA("Model") ~= player.Character then
		shadow_block.Transparency = 1
	else
		shadow_block.Transparency = .5
	end
end)
1 Like

Can you please record a video? And add a couple of lines to test.

remoteEvent.OnServerEvent:Connect(function(player, block, position)
	print(position)
	local clone = game.ReplicatedStorage:WaitForChild("BlueBlock"):Clone()
	clone.Parent = workspace.Blocks.BlueBlocks
	clone.Position = Vector3.new(position)
end)
tool.Activated:Connect(function()
	if tool:FindFirstAncestorWhichIsA('Model') == player.Character then
		print(shadow_block.Position)
		remoteEvent:FireServer("blueBlock", shadow_block.Position)
		print("script is working")
	end
end)
2 Likes


did exactly what you told me to do, heres te video

Can you show the Output? Very strange

You can see the output in the bottom of the video.

It’s down there, if you fullscreen the video or something like that

I see, your part has a collision and is it anchored? (In ReplicatedStorage)

1 Like

Yep, it’s anchored.
(character limit.)