I’m trying to clone a part in a server script in ServerScriptService and then send it to a local script with a remote event. This way, I can make it visible on the client side, so only a specific player can see it.
My problem is that the local script prints the Cloned Part as nil and won’t change its transparency.
Server Script:
function CloneBrick(player)
if db[player] == true then
db[player] = false
local NewBrick = game.ReplicatedStorage.Target:Clone()
NewBrick.Parent = game.Workspace
print(NewBrick)
game.ReplicatedStorage.HideEvent:FireClient(player, NewBrick)
end
end
The part passed will only not be nil when these conditions are met:
The part exists on the client
The part exists the server
This means that one of the two conditions aren’t met. Either you have StreamingEnabled turned on for workspace and are really far away from the part (disable StreamingEnabled and see if the problem goes away). Or there is ping difference where the remote event reaches the player before the part replication does, so put a wait and see if it’s fixed.
Might sound silly, but you might have streamingEnabled on and if you do, you have to use WaitForChild on the part on the client because it might not have streamed in yet