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

Very strange problem, can someone help?

Asked by 8 years ago

I am working on a game which has FilteringEnabled active, when a player joins a local script is cloned to their character in workspace which fixes the camera in place and activates a remote event causing a script in workspace to move the character to another room.

The scripts work fine in test mode however when published or when I start the server the character is not teleported on the clients screen but on the server the player is in the correct place as shown in the screenshot below:

https://gyazo.com/e50a7f62f03c2247a8f15f97f0213d25

The code on the server script in workspace is:

game.Players.PlayerAdded:connect(function( player )

    print(player.Name ..tostring(" has joined"))

    repeat wait() until player.Character.Torso

            local character = player.Character

            wait(0.1)
            script.CameraScript:clone().Parent = character

end)





event = script.ClReady

function event.OnServerInvoke(player, reply)

    repeat wait() until player.Character.Torso

    if player.Character and player.Character:FindFirstChild("Torso") then

        local character = player.Character

        print("Moving character")
        character.Torso.CFrame = CFrame.new(-193.6, 4.5, 0)
        character.Torso.Anchored = true

        print("Character moved")

            if character.ForceField then
                character.ForceField:Destroy()
            end 

        end

end

The code on the client is:

local cam = workspace.CurrentCamera
local Torso = script.Parent.Torso

print("Fireing server")

local wiatForResponse = game.Workspace.Teleport.ClReady:InvokeServer(reply)

cam.CameraSubject = Torso
cam.Focus = CFrame.new(Torso.Position)
cam.CameraType = "Scriptable"
cam.CoordinateFrame = CFrame.new(Torso.Position - Vector3.new(3, -3, 10), Torso.Position + Vector3.new(-4, 0, 0))
0
Do you get any errors in the output window? AwsomeSpongebob 350 — 8y

Answer this question