Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Script stops when on terminated user?

So I made a script that changes my humanoid description to random players

repeat wait(1) local e = math.random(1,1000000000) if game.Players:GetHumanoidDescriptionFromUserId(e) ~= nil then workspace.dimondflash57.Humanoid:ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(e)) workspace.dimondflash57.Head.BillboardGui.Frame.Namee.Text = game.Players:GetNameFromUserIdAsync(e) workspace.dimondflash57.Head.BillboardGui.Frame.Rank.Text = "User id : "..e end until workspace.dimondflash57.Humanoid.Health==0

and when it lands on a terminated user it stops so how do i fix this

1 comment

0

i need help on this

1 answer

✓ Accepted answer
local Players,HumanoidDescription=game:GetService"Players",nil
local function GetHumanoidDescription(e)
local newHumanoidDescription=Players:GetHumanoidDescriptionFromUserId(e)
HumanoidDescription=newHumanoidDescription
end
repeat wait()
local e = math.random(1,1000000000) 
HumanoidDescription=pcall(GetHumanoidDescription,e) and HumanoidDescription or nil

if HumanoidDescription then 
workspace.dimondflash57.Humanoid:ApplyDescription(HumanoidDescription) 
workspace.dimondflash57.Head.BillboardGui.Frame.Namee.Text = Players:GetNameFromUserIdAsync(e)
workspace.dimondflash57.Head.BillboardGui.Frame.Rank.Text = "User id : "..e 
wait(1)	
else
wait(.1) -- shorter wait if it was a terminated user
end
until workspace.dimondflash57.Humanoid.Health==0


1 comment

0

i shortened it

This discussion is preserved as it was. New answers, comments, and votes are closed.