I was making Sheer Heart Attack so I made a serverscript that adds temperature to everything. Onto the script for sha I was going to try and and find see which one had the highest temperature and it goes to that but I had no idea how to loop through which one is the highest.
The best post I found was for this How to check which of the given numbervalues have the highest number? but this one is for stuff thats already in a table.
How would I make this?
while task.wait(1) do
for i, v in pairs(game.Workspace:GetDescendants()) do
local mag = (v.Position - script.Parent.HumanoidRootPart.Position).Magnitude
if mag < 30 then
if v:IsA("BasePart") then
if v:FindFirstChild("Temperature", true) and not v:GetAttribute("hurtbox", true) then
local temp = v:FindFirstChild("Temperature", true)
--where stuff goes
script.Parent:MoveTo() --what i was planning to do once found the highest temp one
end
end
end
end
end