Parent of plr cant be changed

Local:
		butt.MouseButton1Click:Connect(function()
			
			local clonedDress = Dress.Accessory:Clone()
			clonedDress.Parent = game.Players.LocalPlayer.Character
			local plr = game.Players.LocalPlayer
			re:FireServer(plr, clonedDress)
		end)

Server:

local re = game.ReplicatedStorage.RemoteEvent

re.OnServerEvent:Connect(function(plr, dress)
	local character = plr.Character
	dress.Parent = character -- parent of plr cant be changed
end)

help me pls

1 Like

Hi friend, I see it fires the event with player instance, The remote events give player information already and dress is being set to player instance when firing the event.

			local clonedDress = Dress.Accessory:Clone()
			clonedDress.Parent = game.Players.LocalPlayer.Character
			local plr = game.Players.LocalPlayer
			re:FireServer(clonedDress)

Hope this helps! :smile:

1 Like

This solved the original problem. Thanks, but, there’s a new bug. Players.bro_proxiomFun.PlayerGui.ScreenGui.Shk.LocalScript.FireServerByCloth:5: attempt to index nil with ‘Parent’ as I understand it, the game believes that character is nil. But this is not the case.

1 Like

It does this because you cloned the dress on the client, so to the server the cloned object does not exist. Alternatively, pass the original dress through the remote event, then clone it from the server. Hope this helps!

1 Like

As Pure_Bacn said, Since it clones it on the client, the clone cannot pass through remote event, You need to clone on server side if its possible :slightly_smiling_face:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.