Hello developers,
I decided I’d like to share my stamper tool with you guys that I remade to be filtering enabled compatible with my build to survive zombies remake.
It was a pain to fix so I really hope this helps people.
Note: Some models won’t work that have scripts in them due to the fact Roblox made them and I have no way of fixing them to be filtering enabled.
https://www.roblox.com/library/6375057601/Stamp-Tool-Remade
Code in a ServerScriptService script you will need:
game.ReplicatedStorage.RequestBrick.OnServerEvent:Connect(function(player, assetId)
local asset = game.ReplicatedStorage.Assets:FindFirstChild(assetId)
if asset == nil then
asset = game:GetService("InsertService"):LoadAsset(assetId)
asset.Name = assetId
asset.Parent = game.ReplicatedStorage.Assets
for _,v in pairs(asset:GetDescendants()) do
if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("BasePart") or v:IsA("WedgePart") or v:IsA("CornerWedgePart") or v:IsA("UnionOperation") or v:IsA("PartOperation") or v:IsA("TrussPart") then v.Anchored = true
end
end
end
end)
function game.ReplicatedStorage.filterSet.OnServerInvoke(player,setId)
return game:GetService("InsertService"):GetCollection(setId)
end
function game.ReplicatedStorage.GetUserCategories.OnServerInvoke(player,userIdForStamperParts)
return game:GetService("InsertService"):GetUserCategories(userIdForStamperParts)
end
function game.ReplicatedStorage.LoadAsset.OnServerInvoke(player,assetId)
local asset = game.ReplicatedStorage.Assets:FindFirstChild(assetId)
if asset == nil then
asset = game:GetService("InsertService"):LoadAsset(assetId)
asset.Name = assetId
asset.Parent = game.ReplicatedStorage.Assets
for _,v in pairs(asset:GetDescendants()) do
if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("BasePart") or v:IsA("WedgePart") or v:IsA("CornerWedgePart") or v:IsA("UnionOperation") or v:IsA("PartOperation") or v:IsA("TrussPart") then v.Anchored = true
end
end
end
return asset
end
AnchoredParts = {}
function Build(Name,ObjectID,Position,ObjectName,mouseHitInWorld)
local insertCFrame
local Place = game.Workspace.ActiveParts:FindFirstChild(Name.Name .. "'s parts")
local M = game:GetService("InsertService"):LoadAsset(ObjectID)
if M[ObjectName].ClassName == "Model" then
M.Parent = Place
local MParts = M[ObjectName]:GetChildren()
for i = 1 ,#MParts do
if MParts[i]:IsA("BasePart") then
if MParts[i].Anchored == true then
table.insert(AnchoredParts,i,MParts[i])
end
MParts[i].Anchored = true
end
end
local M = M[ObjectName]
M:MakeJoints()
M:MoveTo(mouseHitInWorld)
M.Name = ObjectName
game.JointsService:CreateJoinAfterMoveJoints()
for i = 1 ,#MParts do
if MParts[i]:IsA("BasePart") then
MParts[i].Anchored = true
MParts[i].BrickColor = BrickColor.White()
end
end
for i = 1,#AnchoredParts do
AnchoredParts[i].Anchored = true
end
else
local object = M[ObjectName]
object.Parent = Place
object.CFrame = Position
object.CFrame:pointToObjectSpace(mouseHitInWorld)
object.Anchored = true
end
end
game.ReplicatedStorage.BuildObject.OnServerEvent:Connect(Build)
game.ReplicatedStorage.RenameRoot.OnServerEvent:Connect(function(player,root)
root.Name = "InsertedObject" .. root.Name
end)
Also, make sure to include the remote functions and remote events in the script in replicated storage
If you have any problems please let me know and I’ll be happy to help.