How would I create this?

I think changing it to game:GetService(“RunService”). Heartbeat would be more better. Using while true do is kinda not good.