World Portal Script

Anyone know why this might not be working? Currently set to the 2nd world I have ready.

local GoToWorld = {}

– Script properties are defined here
GoToWorld.Properties = {
{name = “world”, type = “worldasset”},
}

–This function is called on the server when this entity is created
function GoToWorld:Init()
end

function GoToWorld:OnTriggerEnter(person)
if(person) then
person:GetUser():GoToWorld(self.properties.world)
Print(“World Changing”)
end
end

return GoToWorld

That wasnt the issue but DryCoast on the Crayta Discord #AskAnything chat solved it;

  1. Make sure the script is put on a trigger rather than a mesh/voxel mesh &
  2. Make sure the trigger has playeronly & interactable enabled &
  3. Should be formatted as the following

function GoToWorld:OnTriggerEnter(person)
if person:IsA(Character) then
Print(“World Changing”)
person:GetUser():GoToWorld(self.properties.world)
end
end