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

FilteringEnabled: TCP is not a valid member of player?

Asked by 6 years ago

Whats supposed to happen is you click a button, it fires an event to the server which will then open the doors on the right hand side.

When I click the button it says "TCP isn't a valid member of Player"

eventScript:

function OpenDoor(door,num)
    local left = door.Left:GetChildren()
    for n=1, #left do
        if left[n].ClassName == "Part" then
            left[n].Mesh.Offset = Vector3.new(-0.1*num, 0, 0)
            if num == 36 then
                left[n].CanCollide = false
            end
        end
    end
    local right = door.Right:GetChildren()
    for b=1, #right do
        if right[b].ClassName == "Part" then
            right[b].Mesh.Offset = Vector3.new(0.1*num, 0, 0)
            if num == 36 then
                right[b].CanCollide = false
            end
        end
    end
    end

script.openRightDoors.OnServerEvent:connect(function(TrainVal)
    if TrainVal.TCP.Dir.Value == false then
        for a=1, 36 do
            OpenDoor(TrainVal.Car1.Door3,a)
            OpenDoor(TrainVal.Car1.Door4,a)
            OpenDoor(TrainVal.Car2.Door3,a)
            OpenDoor(TrainVal.Car2.Door4,a)
            wait(.01)
        end
    else
        for a=1, 36 do
            OpenDoor(TrainVal.Car1.Door1,a)
            OpenDoor(TrainVal.Car1.Door2,a)
            OpenDoor(TrainVal.Car2.Door1,a)
            OpenDoor(TrainVal.Car2.Door2,a)
            wait(.01)
        end

Button:

TrainVal = script.Parent.Parent.Parent.Train.Value

function onClick()
    game.Workspace.traineventScript.openRightDoors:FireServer(TrainVal)
end
script.Parent.MouseButton1Click:connect(onClick)

1 answer

Log in to vote
0
Answered by 6 years ago

OnServerEvent passes the player that the request came from automatically as the first argument since Roblox knows who the request came from, it can only be from that one player.

This will mean that 'TrainVal' holds the player note the error 'TCP is not a valid member of player'. To resolve this all we need to do is include another argument which will then hold the player.

Example:-

script.openRightDoors.OnServerEvent:connect(function(plr, TrainVal)
    print(plr, TrainVal) -- note i do not know what TrainVal is
end)

I hope this helps.

0
It's not printing anything so I'm unsure if it works or not CondescendingReality 7 — 6y
0
I would just test the remote event part first then move onto the opening of the door User#5423 17 — 6y
Ad

Answer this question