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

Attempt to call global Vector3? [FIXED]

Hello,

Recently I have been trying to make a door which slides up and down when you press a button, I am trying to get it so the script looks for the position of the door and if it is equal to 190.253, 8.125, 67.725, then make the door open by sliding up. But on the 6th line, it comes up with the error of

Workspace.Model.LeftDoor.Button.Script:6: attempt to call global 'Vector3' (a table value)

local LeftDoor = script.Parent.Parent.Parent.LeftOfficeDoor
local RightDoor = script.Parent.Parent.Parent.RightOfficeDoor
local Sound = script.Parent.Sound

script.Parent.ClickDetector.MouseClick:connect (function()
	if LeftDoor.CFrame == (Vector3(190.253, 8.125, 67.725)) then
		for i = 1,14 do
			LeftDoor.CFrame = CFrame.new(LeftDoor.Position + Vector3(0,1,0))
		    wait()
		end
			Sound.Playing = false
			Sound.Playing = true
	else if LeftDoor.Position == (Vector3(190.253, 22.125, 67.725)) then
			for i = 1,14 do
			LeftDoor.CFrame = CFrame.new(LeftDoor.Position - Vector3(0,1,0))
		    wait()
	  end
			Sound.Playing = false
			Sound.Playing = true
	end
  end
end)

Does anybody know a way of fixing this?

4 comments

0

You should do Vector3.new instead of Vector3. Maybe that is your problem...

0

So I would do something like if LeftDoor.CFrame == (Vector3.new(190.253, 8.125, 67.725)) then? Because that didn't work

0

uh no, if LeftDoor.CFrame == Vector3.new(--Position--)

0

I hope it would work

2 answers

This should work

local LeftDoor = script.Parent.Parent.Parent.LeftOfficeDoor
local RightDoor = script.Parent.Parent.Parent.RightOfficeDoor
local Sound = script.Parent.Sound

script.Parent.ClickDetector.MouseClick:connect (function()
    if LeftDoor.CFrame == Vector3(190.253, 8.125, 67.725)) then
        for i = 1,14 do
            LeftDoor.CFrame = CFrame.new(LeftDoor.Position + Vector3(0,1,0))
            wait()
        end
            Sound.Playing = false
            Sound.Playing = true
    else if LeftDoor.Position == Vector3.new(190.253, 22.125, 67.725)) then
            for i = 1,14 do
            LeftDoor.CFrame = CFrame.new(LeftDoor.Position - Vector3(0,1,0))
            wait()
      end
            Sound.Playing = false
            Sound.Playing = true
    end
  end
end)

1 comment

0

Same error, also an error with ) on like 06 and 13 which I removed, yet same error. 15:25:57.198 - Workspace.Model.LeftDoor.Button.Script:6: attempt to call global 'Vector3' (a table value)

I've created a new script for it and it works, kind of.

local LeftDoor = script.Parent.Parent.Parent.LeftOfficeDoor
local RightDoor = script.Parent.Parent.Parent.RightOfficeDoor
local Sound = script.Parent.Sound
local debounce = false
local door = false

script.Parent.ClickDetector.MouseClick:connect(function()
    if not debounce then debounce = true
	if not door then door = true
		    Sound.Playing = false
            Sound.Playing = true
        for i = 1,14 do
            LeftDoor.CFrame = CFrame.new(LeftDoor.Position + Vector3.new(0,1,0))
            wait()
        end
               debounce = false
    else if door then door = false
	        Sound.Playing = false
            Sound.Playing = true
            for i = 1,14 do
            LeftDoor.CFrame = CFrame.new(LeftDoor.Position - Vector3.new(0,1,0))
            wait()
end
		debounce = false
    end
  end
end
end)

Its a bit more but it works

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