Oh, I forgot to rename that… but anyways thats unrelated.
If you have updated your code with some of the suggestions by the people here, could you post it? I really want to help you but im kinda stumped
MoveTo()?
If this doesnt work then the script isnt the problem- unless i did moveto incorrectly
local Base = workspace:WaitForChild("Base")
local entranceHatch = Base:WaitForChild("Entrance")
local exitHatch = Base:WaitForChild("Exit")
local exitPos = entranceHatch.Position + Vector3.new(0, 5, 0)
local entrancePos = exitHatch.Position - Vector3.new(0, 5, 11)
exitHatch.BaseExit.Triggered:Connect(function(player)
local char = player.Character or player.CharacterAdded:Wait()
char:MoveTo(exitPos)
print(`{player.Name} left the building`)
end)
entranceHatch.BaseExit.Triggered:Connect(function(player)
local char = player.Character or player.CharacterAdded:Wait()
char:MoveTo(entrancePos)
print(`{player.Name} entered the building`)
end)
Again, its not a problem with teleporting. The problem is with the proximity prompt not triggering when a player triggers it.
I believe it has to be humanoid:MoveTo but i could be wrong. Also you could easily get the humanoid from the character, char.Humanoid
You can try removing the WaitForChild like how @Aerophagia did, the script may be infinitely waiting or something.
Alright, here is my updated code:
local Base = workspace:WaitForChild("Base");
local entranceHatch = Base.EntrancePrompt
local exitHatch = Base.ExitPrompt
local exitPos = CFrame.new(entranceHatch.Position + Vector3.new(0, 5, 0));
local entrancePos = CFrame.new(exitHatch.Position - Vector3.new(0, 5, 11));
exitHatch.BaseExit.Triggered:Connect(function(player)
print("Triggered");
local character = player.Character or player.CharacterAdded:Wait();
character.HumanoidRootPart.CFrame = exitPos;
end)
(For testing reasons I am only using exitHatch for now)
Could it be because of the ; you are using? I cant imagine this is a problem but… who knows.
Other than that i dont see what could be going wrong, maybe try changing the script to being inside the part that has the promt to test if that works.
Could you show a screenshot of the workspace in the explorer?
nevermind i read it wrong whoopsie
Try adding a print function at the start of the script, in case the script is the problem.
I have verified that the script isn’t the problem using a print statement
Is the Base folder in the workspace or in another folder or instance / another instance in the workspace called Base? If not, then I can’t think of anything else that could be causing the problem.
The Base
folder is in another folder called Structures
, but for the sake of simplicity of this forum, I just pretended like its in workspace
.
Try experimenting around / rewrite the script, or put the same code in a different script. Other than that, I don’t think there’s anything else I can do to help. Good luck and hope you solve your problem
Alright, thanks for trying to help.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.