I made this script, and it crashes my roblox studios! I'm not sure why.. Please let me know!
while true do local HealthNum = game.workspace.Cake.Humanoid.Health script.Parent.Text = HealthNum.."/100" end
Simple, the while true do
loop is attempting to execute without any delay time. Basically it's trying to run multiple operations at once infinitely, and that causes roblox crashes. Obviously the simplest way to fix it is by putting a wait(Seconds)
somewhere in the loop, preferably at the beginning or at the end, like so:
while true do local HealthNum = game.workspace.Cake.Humanoid.Health script.Parent.Text = HealthNum.."/100" wait() --This makes the loop wait 1/30th of a second end
Hope this helped!
A smarter way to approach this would be to do the following:
Humanoid = game:GetService("Workspace"):WaitForChild("Cake").Humanoid Humanoid.Changed:connect(function() script.Parent.Text = Humanoid.Health.."/100" end)