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

Part1 is in workspace but Part1 is not a valid member of Workspace in the dev console?

Asked by 4 years ago

Script: game.ReplicatedStorage:WaitForChild("Cutscene1").OnClientEvent:Connect(function() if script.Done.Value == false then script.Done.Value = true

        local camera = game.Workspace.CurrentCamera

        camera.CameraType = "Scriptable"
        camera:Interpolate(game.Workspace.Part1.CFrame, game.Workspace.Part2.CFrame, 2)
        wait(2)
        camera:Interpolate(game.Workspace.Part2.CFrame, game.Workspace.Part3.CFrame, 2)
        wait(2)
        camera:Interpolate(game.Workspace.Part3.CFrame, game.Workspace.Part4.CFrame, 2)
        wait(2)
        camera:Interpolate(game.Workspace.Part4.CFrame, game.Workspace.Part5.CFrame, 2)
        wait(2)
        camera:Interpolate(game.Workspace.Part5.CFrame, game.Workspace.Part6.CFrame, 2)
        wait(2) camera.CameraType = "Custom"


    end
end)

Cant find Part1 in workspace when it is there

0
put local Part1 = game.Workspace:WaitForChild("Part1") XxebaxXGAMER 0 — 4y
0
How did you add Part1 in Workspace? Have you created them with a LocalScript? masterjosue1998 116 — 4y
0
Yes @masterjosuel1998 Fshduia 9 — 4y
0
camera:Interpolate() is deprecated. Use tween instead qVoided 221 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You need to wait for the part to load in. The scripts run instantly therefore use :WaitForChild()

local part 1  = game.Workspace:WaitForChild("Part1")

You could do it without making a variable.

        local camera = game.Workspace.CurrentCamera

        camera.CameraType = "Scriptable"
        camera:Interpolate(game.Workspace:WaitForChild("Part1").CFrame, game.Workspace:WaitForChild("Part2").CFrame, 2)
        wait(2)
        camera:Interpolate(game.Workspace:WaitForChild("Part2").CFrame, game.Workspace:WaitForChild("Part3").CFrame, 2)
        wait(2)
        camera:Interpolate(game.Workspace:WaitForChild("Part3").CFrame, game.Workspace:WaitForChild("Part4").CFrame, 2)
        wait(2)
        camera:Interpolate(game.Workspace:WaitForChild("Part4").CFrame, game.Workspace:WaitForChild("Part5").CFrame, 2)
        wait(2)
        camera:Interpolate(game.Workspace:WaitForChild("Part5").CFrame, game.Workspace:WaitForChild("Part6").CFrame, 2)
        wait(2) camera.CameraType = "Custom"


    end
end)
0
I just want to say, adding the ("Part1") kinda breaks it Fshduia 9 — 4y
0
this comes up now 15:18:10.711 - Players.fshduia.PlayerGui.LocalScript:16: Expected <eof>, got 'end' Fshduia 9 — 4y
0
I don't know where line 711 is kingblaze_1000 359 — 4y
Ad

Answer this question