MainItems:WaitForChild("MainDoor").Touched:Connect(function(Hit)
// code here
end)
You donât have this line:
MainItems:WaitForChild("OwnerDoor", 1):WaitForChild("MainDoor", 1).Touched:Connect(function(hit)
which line do i paste it on?
im just curios.
Instead of the MainItems:WaitForChild()
line. Make sure itâs only one line what you paste. Also, quick note, I made it so that if it doesnât find the item in one second, the code doesnât run.
i dont understand, do i delete the MainItems:WaitForChild() line then paste it in?
Yes. That should work. If you donât want the function to not run if it doesnt find the instance, type the line like this:
MainItems:WaitForChild("OwnerDoor"):WaitForChild("MainDoor").Touched:Connect(function(hit)
ONLY do that if you want to see if the instance doesnt exist. If it doesnât, you will see an error: "infinite yield possible on [v:WaitForChild()].
Is it a server or local script? Where is it located?
I put it in scs
You should use starterplayerscripts
rather, like i mentioned.
i put it in startercharacterscripts, what do you mean?
like remove the folder and only the main script?
The startercharacter
scripts get cloned in the players character
which is a descendant of workspace
. And you know what that means, right?
Also where did you declare the MainItems
variable? As itâs most likely the error here.
i donât know sadly.
i do very poor in coding, yet i get enjoyment out of it.
Change TycoonModel:FindFirstChild("MainItems")
to TycoonModel:WaitForChild("MainItems")
. If it says infinite yield in the output then do TycoonModel:WaitForChild("MainItems", 1)
and check the TycoonModel
variable for the same thing. Go into the explorer and check if thereâs already the models that you need. It seems like as all the things you need donât land where you need them.
Check the TycoonModel for same thing.
wdym?
i donât really understand