Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i clone something using Filtering enabled?

i know how to clone and stuff, but when you go to clone something while using FE, it clones but gets deleted after a while. i even tried using remote events and it still got deleted.

Please help

Local script

local remote = game:GetService('ReplicatedStorage'):WaitForChild('RemoteEvent')
local hat = game:GetService('ReplicatedStorage'):WaitForChild('Bighead')
local cam = game.Workspace.CurrentCamera

local player = game.Players.LocalPlayer
local char = player.Character



remote:FireServer({hat, cam})

Server script

local partRemote = Instance.new('RemoteEvent')
local replicated = game:GetService('ReplicatedStorage')
partRemote.Parent = replicated


partRemote.OnServerEvent:connect(function(player, arguments)
	local bighead = arguments[1]:Clone()
	bighead.Parent = arguments[2]
end)

1 answer

Don't replicate the actual object as an argument. Replicate it's name, then reference it on the server and clone it that way.

Also, the camera is only accessible from the Client. Attempting to parent the hat to the Camera from the server makes the whole RemoteEvent process redundant, since you can do that on the client anyways.

Localscript;

local remote = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local hat = game.ReplicatedStorage:WaitForChild("Bighead")
local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer

repeat wait() until player.Character

local char = player.Character

remote:FireServer(hat.Name)

Serverscript;

local replicated = game.ReplicatedStorage;
local partRemote = Instance.new("RemoteEvent",replicated)

partRemote.OnServerEvent:connect(function(player, argument)
	--Reference it on the server
	local bighead = replicated:WaitForChild(argument);
	bighead:Clone().Parent = workspace;
end)

3 comments

0

still doesnt work, it clones yes but gets deleted afterwards

0

I'm afraid there's just no reason for that. Make sure there are no scripts interfering. Check your hat object for viruses. You could also try just scrapping this whole RemoteEvent and cloning the hat into the Camera from the client.

0

If there's no reason for the rest of the server to see the hat object then you can go without replicating this :)

This discussion is preserved as it was. New answers, comments, and votes are closed.