Hi,
i used Player:SetPosition() with HOOK_PLAYER_SPAWED Event.
But if the player died in WorldX and i used with spawn the Player:SetPosition() command then
spawn the player in DefaultWorld and not in WorldX. Why? I used "return true" after Player:SetPosition().
i used Player:SetPosition() with HOOK_PLAYER_SPAWED Event.
But if the player died in WorldX and i used with spawn the Player:SetPosition() command then
spawn the player in DefaultWorld and not in WorldX. Why? I used "return true" after Player:SetPosition().
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | function PlayerSpawned(Player) local PlayersUUID = Player:GetUUID() local PlayersCurrentWorld = Player:GetWorld() local CurrentWorldSettings = WorldBedSetting:getWorldSet(PlayersCurrentWorld) print ( "CurrentWorldSettings:" , PlayersCurrentWorld:GetName(), CurrentWorldSettings) local SpawnWorld = cRoot:Get():GetWorld(CurrentWorldSettings.SpawnWorld) local SpawnWorldSettings = WorldBedSetting:getWorldSet(SpawnWorld) if (CurrentWorldSettings.BedAllow and PlayersPositions:IsBedActive(Player, PlayersCurrentWorld)) then print ( "Bed CurrentWorld: Bed erlaubt & Bed Existiert" ) -- if bed esist in this world > Port To Bed local BedPos = PlayersPositions:GetBed(Player, PlayersCurrentWorld) print ( "Bedposition in :" .. PlayersCurrentWorld:GetName(),BedPos.BedPosX, BedPos.BedPosY, BedPos.BedPosZ) Player:SetPosition(BedPos.BedPosX, BedPos.BedPosY, BedPos.BedPosZ) return true elseif (SpawnWorldSettings.BedAllow and PlayersPositions:IsBedActive(Player, SpawnWorld)) then print ( "Bed SpawnWorld: Bed erlaubt & Bed Existiert" ) -- if bed exist in SpawnWorld > Port to Bed in SpawnWorld local BedPos = PlayersPositions:GetBed(Player, SpawnWorld) local spawnpos3d = Vector3d(BedPos.BedPosX, BedPos.BedPosY, BedPos.BedPosZ) Player:ScheduleMoveToWorld(SpawnWorld,spawnpos3d,false) return true else -- whats spawn method in SpawnWorld if (SpawnWorldSettings.RandomSpawn == true) then print ( "RandomSpawn" ) PortToRandomPos(Player,SpawnWorld,PlayersCurrentWorld) return true else print ( "MapSpawn" ) PortToMapSpawn(Player, SpawnWorld, PlayersCurrentWorld) return true end end return true end |