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

How do i make Remote Functions Arguments work??

the error is 'BackgroundTransparency is not a valid member of Player 22:56:19.535 - Stack Begin'

local oo= Instance.new("RemoteEvent")
oo.Name = "CharChangeEvent"
oo.Parent = game.ReplicatedStorage.RemoteEvents.Gui
oo.OnServerEvent:connect(function(Player, X)
	X.BackgroundTransparency = 0
	X.Side.BackgroundTransparency = 0
	Player.PlayerGui.Gui.Create.FaceFrame.Visible = false
	Player.PlayerGui.Gui.Create.GenderFrame.Visible = false
	Player.PlayerGui.Gui.Create.MarkFrame.Visible = false
	Player.PlayerGui.Gui.Create.HairFrame.Visible = false
	local function CharacterValues()
	local NewC = Player.Gamestuff.Characters.NewCharacter
	local Character = Player.Character
	local BodyColors = Character:findFirstChild("Body Colors")
	local BColorVal = NewC.BColors.Value
	local HairColorVal = NewC.HairColor.Value
	local HairMesh = NewC.HairId.Value
	--HairColor.BrickColor = HairColorVal
	BodyColors.HeadColor = BColorVal
	BodyColors.LeftArmColor = BColorVal
	BodyColors.LeftLegColor = BColorVal
	BodyColors.RightArmColor = BColorVal
	BodyColors.RightLegColor = BColorVal
	BodyColors.TorsoColor = BColorVal
	Character.Head.face.Texture = NewC.Face.Value
	if Player.Character:findFirstChild("Hat") then
		Player.Character.Hat:destroy()
		end
		debounce = false
		h = Instance.new("Hat")
		p = Instance.new("Part")
		h.Name = "Hat"
		p.Parent = h
		p.Position = Player.Character:findFirstChild("Head").Position
		p.Name = "Handle" 
		p.formFactor = 0
		p.Size = Vector3.new(1,2,2) 
		p.BottomSurface = 0 
		p.TopSurface = 0 
		p.Locked = true 
	    Mesh = Instance.new("SpecialMesh",p)
		h.Parent = Player.Character
		if HairMesh == "Bald" then
			Player.Character.Hat:destroy()
		end
	    if HairMesh == "Equinox" then
		Mesh.MeshId = "http://www.roblox.com/asset/?id=19326912"
		p.BrickColor = Player.Gamestuff.Characters.NewCharacter.HairColor.Value
		h.AttachmentForward = Vector3.new(-0, -0, -1)
		h.AttachmentPos = Vector3.new(0, -0.14, -0.07)
		h.AttachmentRight = Vector3.new(1, 0, 0)
		h.AttachmentUp = Vector3.new(0, 1, 0)
		elseif HairMesh == "GirlAnimeHair" then
		Mesh.MeshId = "http://www.roblox.com/asset/?id=164382853"
		p.BrickColor = Player.Gamestuff.Characters.NewCharacter.HairColor.Value
		h.AttachmentForward = Vector3.new(0, 0, 1)
		h.AttachmentPos = Vector3.new(0.0500000007, 1, -0.0500000007)
		h.AttachmentRight = Vector3.new(1, 0, 0)
		h.AttachmentUp = Vector3.new(0, 1, 0)
		end
	end
end)

Called

FaceButt.MouseEnter:connect(function()
	game.ReplicatedStorage.RemoteEvents.Gui.CharChangeEvent:FireServer(Player,FaceButt)
end)

It says the property isnt in player but Its supposed to be in The button?

1 answer

✓ Accepted answer

With RemoteEvents, when firing to the server, you don't need to worry about including a Player parameter as there already is one.

When RECEIVING on the server, the first parameter is ALWAYS the player, no matter what. The rest are the arguments that are passed. So...

FaceButt.MouseEnter:connect(function()
    game.ReplicatedStorage.RemoteEvents.Gui.CharChangeEvent:FireServer(FaceButt)
end)

By making that edit, the script will run smoothly since the player argument is required by default. Hope I helped!

See this wiki post for a better explanation.

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