For example,
Who dies cannot see any “alive” players by 35 seconds and after that time they come back to life, and “alive” players cannot see any dead players until they come back to life…
How could I do something like that?
Any idea? please
You could loop through every player on the client of the player who died and make everyone else ghosts. Like this.
Local Script
local localplr = game.Players.LocalPlayer
wait(3)
player.Character:WaitForChild("Humanoid").Died:Connect(function()
for I, player in pairs(game.Players:GetChildren()) do
if player~= localplr then
for I, v in pairs(player.Character:GetChildren()) do
if v:IsA("BasePart") then
v.Transparency = 1
end
end
end
end
wait(35)
for I, player in pairs(game.Players:GetChildren()) do
if player~= localplr then
for I, v in pairs(player.Character:GetChildren()) do
if v:IsA("BasePart") then
v.Transparency = 0
end
end
end
end
end)
On a serverscript, when someone dies you can wait for them to respawn, then you can make them invisible like this:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Wait()
player.Character:WaitForChild("Humanoid").Died:Connect(function()
player.CharacterAdded:Wait()
for I, v in pairs(player.Character:GetChildren()) do
if v:IsA("BasePart") then
v.Transparency = 1
end
end
wait(35)
for I, v in pairs(player.Character:GetChildren()) do
if v:IsA("BasePart") then
v.Transparency = 1
end
end
end)
end
If I set the transparency to 0 in the same way, only those who are dead will be able to see each other and the players will not be able to see the dead?
Having ghosts see each other and players see each other is much more complicated. On the server I would detect when someone dies, and I would have a table of all the players who are dead and alive. When someone dies fire all the clients who are in the dead table and make that person transparent. When someone becomes a player again you would have to fire the dead players to make them transparent and fire the alive players to make them visible.