Hi! I want to clone a BoolValue so its parent is the Player
-- server script game.ReplicatedStorage.CopyInGameValue.OnServerEvent:Connect(function() local original = game.ServerStorage.InGame local copy = original:Clone() copy.Parent = game.Players:FindFirstChild() print("copied") end) -- Local Script game.ReplicatedStorage.CopyInGameValue:FireServer()
The error says 01:21:00.418 - Argument 1 missing or nil
Before we start, I recommend you to make your code inline, so it is easier to read. But, I will not inline it, because you have not.
--Server Script
local CopyInGameValue = game:GetService("ReplicatedStorage"):WaitForChild("CopyInGameValue") local original = game.ServerStorage.InGame local copy = original:Clone() copy.Parent = game.Players:FindFirstChild() or game.Players.LocalPlayer print(copy.Parent) if copy.Parent = game.Players.LocalPlayer or game.Players:FindFirstChild() then print("yep") end end)
--Local script
game.ReplicatedStorage.CopyInGameValue:FireServer()
So I think most likely the problem is, is that the () in FindFirstChild, there should be something in those parenthesis. That's why, if that won't work, I added an or to make sure it would still work. I also added printing to make sure that the script works. If it does and you want to remove the printing, deleting everything from if copy.Parent to end (The end after the print('yep')
If this helped you out, be sure to accept the answer!