Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pubg #4

Open
TR38EFE38 opened this issue Jun 25, 2023 · 1 comment
Open

Pubg #4

TR38EFE38 opened this issue Jun 25, 2023 · 1 comment

Comments

@TR38EFE38
Copy link

-- Oyunculara erişme
local Players = game:GetService("Players")

local function addSpawn(spawnLocation)
-- listen for the spawn being touched
spawnLocation.Touched:Connect(function(hit)
local character = hit:FindFirstAncestorOfClass("Model")
if character then
local player = Players:GetPlayerFromCharacter(character)
if player and player.RespawnLocation ~= spawnLocation then
local humanoid = character:FindFirstChildOfClass("Humanoid")

			-- Oyuncu ölmediyse
			if humanoid and humanoid:GetState() ~= Enum.HumanoidStateType.Dead then
				print("spawn set")
				
				-- Spawnpoint'i ayarla
				player.RespawnLocation = spawnLocation
			end
		end
	end
end)

end

local firstSpawn

-- Workspace üzerindeki tüm parçaları azalarak sıralama
for _, descendant in pairs(workspace:GetDescendants()) do
-- Obje SpawnPoint öğesisi
if descendant:IsA("SpawnLocation") then
-- SpawnPoint'in ismi FirstSpawn ise
if descendant.Name == "FirstSpawn" then
--- İlk spawnpoint noktasını belirleme ve firstSpawn objesine atama
firstSpawn = descendant
end

	addSpawn(descendant)
end

end

-- Her oyunucuyu ilk spawnpoint üzerinde doğurma
local function playerAdded(player)
player.RespawnLocation = firstSpawn
end

-- Oyuncular oyuna bağlandığında metot çalıştırma
Players.PlayerAdded:Connect(playerAdded)

@taiA98
Copy link

taiA98 commented Jun 28, 2023

???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants