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

Script does the script before the script and gets mad because its already done it?

local function OnTouch()
	local Camera = workspace.CurrentCamera
	Camera.CameraType = "Attach"
	Camera.CameraSubject = workspace["This'll stop them!"]
	wait(1)
	workspace["This'll stop them!"].Name = "Hey"
	wait(3)
	workspace.Hey.Parent = game.ServerStorage
	local e = game.ServerStorage:FindFirstChild("Hello, Hello.")
	e.Parent = workspace
	Camera.CameraSubject = e
end

script.Parent.Touched:Connect(OnTouch)

If you need me to elaborate on anything let me know in the comments.

INFO:

The error is on line 6. I've looked at the workspace and it changes the name to "Hey" but the problem with that is then it doesn't recognize it in the same line of code that the name is being changed in. This confuses me because wouldn't it just go to the next line if the line worked, so why is it doing it again?

It is a server script.

Here is the output error:

09:43:58.444 - This'll stop them! is not a valid member of Workspace "Workspace"

2 comments

0

Do I need to debounce or something incase it touches the brick twice? I don't think that's the case as the whole script works and changes everything up until that part.

0

The reason why it says it's not a valid member of workspace is because YOU haven't put it in workspace. Make sure you have the correct spelling. I doubt this script will work anyways, since you need a local script to change the player's camera.

1 answer

Maybe try doing this

local function OnTouch()
    local Camera = workspace.CurrentCamera
    Camera.CameraType = "Attach"
    Camera.CameraSubject = workspace["This'll stop them!"]
    wait(1)
    Camera.CameraSubject.Name = "Hey"
    wait(3)
    workspace.Hey.Parent = game.ServerStorage
    local e = game.ServerStorage:FindFirstChild("Hello, Hello.")
    e.Parent = workspace
    Camera.CameraSubject = e
end

script.Parent.Touched:Connect(OnTouch)

Hope this helps!

3 comments

0

might work might not sorry if it doesnt

0

ok ill try it!

0

ok ill try it!

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