Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make Remote Functions Arguments work??

Asked by 7 years ago

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

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
7 years ago

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.

Ad

Answer this question