Delivery System Not Working

Here is the script

local BurgerBag = script.Parent

local function BagDelevierdChecker(hit)
	local Door = game.Workspace.HouseDeliverBurger.Door(hit)
	local ThanksMessage = Door.Parent.ThanksMessage:GetChildren("uni0021")
	if Door then
		wait(2)
		Door.Position = Vector3.new(16.223, 9.6, -361.5)
		Door.Oreintation = Vector3.new(0, -180, 0)
		wait(4)
		ThanksMessage.Transparency = 0
		wait(2)
		ThanksMessage.Transparency = 1
		wait(1)
		Door.Position = Vector3.new(19.723, 9.6, -364)
		Door.Oreintation = Vector3.new(0,90,0)
		BurgerBag.Parent:Destroy()
	end
end


BurgerBag.Touched:Connect(BagDelevierdChecker)

Here is the error

  18:58:18.024  Workspace.Burger Bag.Handle.BurgerHouse:4: attempt to call a Instance value  -  Server - BurgerHouse:4
  18:58:18.026  Stack Begin  -  Studio
  18:58:18.026  Script 'Workspace.Burger Bag.Handle.BurgerHouse', Line 4 - function BagDelevierdChecker  -  Studio - BurgerHouse:4
  18:58:18.027  Stack End  -  Studio
  18:58:18.027  Workspace.Burger Bag.Handle.BurgerHouse:4: attempt to call a Instance value  -  Server - BurgerHouse:4
  18:58:18.028  Stack Begin  -  Studio
  18:58:18.028  Script 'Workspace.Burger Bag.Handle.BurgerHouse', Line 4 - function BagDelevierdChecker  -  Studio - BurgerHouse:4
  18:58:18.029  Stack End  -  Studio
1 Like

you put the brackets used to call a function “()” instead of the square ones “[]”.

local Door = game.Workspace.HouseDeliverBurger.Door[hit]

try that

1 Like
  19:13:21.338  Workspace.Burger Bag.Handle.BurgerHouse:4: invalid argument #2 (string expected, got Instance)  -  Server - BurgerHouse:4
  19:13:21.338  Stack Begin  -  Studio
  19:13:21.338  Script 'Workspace.Burger Bag.Handle.BurgerHouse', Line 4 - function BagDelevierdChecker  -  Studio - BurgerHouse:4
  19:13:21.338  Stack End  -  Studio
  19:13:23.509  0.5, 0.5  -  Server
  19:13:23.965  0.5, 0.5  -  Client
  19:13:36.343  Workspace.Burger Bag.Handle.BurgerHouse:4: invalid argument #2 (string expected, got Instance)  -  Server - BurgerHouse:4
  19:13:36.343  Stack Begin  -  Studio
  19:13:36.343  Script 'Workspace.Burger Bag.Handle.BurgerHouse', Line 4 - function BagDelevierdChecker  -  Studio - BurgerHouse:4
  19:13:36.344  Stack End  -  Studio
  19:13:36.875  Workspace.Burger Bag.Handle.BurgerHouse:4: invalid argument #2 (string expected, got Instance)  -  Server - BurgerHouse:4
  19:13:36.876  Stack Begin  -  Studio
  19:13:36.876  Script 'Workspace.Burger Bag.Handle.BurgerHouse', Line 4 - function BagDelevierdChecker  -  Studio - BurgerHouse:4
  19:13:36.876  Stack End  -  Studio
  19:13:36.876  Workspace.Burger Bag.Handle.BurgerHouse:4: invalid argument #2 (string expected, got Instance)  -  Server - BurgerHouse:4
  19:13:36.876  Stack Begin  -  Studio
  19:13:36.876  Script 'Workspace.Burger Bag.Handle.BurgerHouse', Line 4 - function BagDelevierdChecker  -  Studio - BurgerHouse:4
  19:13:36.877  Stack End  -  Studio
1 Like

hmm… Could you explain what you are trying to do? Let’s say I am in your game and I touched a BurgerBag, what is suppose to be happening?

1 Like

A Player is not supposed to touch it, basically if you deliver it to a door with a “Burger” over it then, If the Bag touches the door then, the events will happen.

1 Like

out of topic but, why don’t you put the script in the door instead? something like:

local Door = script.Parent

local function BagDelevierdChecker(hit)
	local ThanksMessage = Door.Parent.ThanksMessage:GetChildren("uni0021")
	if hit.Name == "BurgerBag" then
		-- Code
	end
end

Door.Touched:Connect(BagDelevierdChecker)

if you prefer to put it in the BurgerBag anyway, what are the BurgerBag’s children?