So everything works fine in studio but nothing works in game. When I look at errors in game on client it says "Hello World!" a bunch. So I am guessing the scripts reset when I load in to the default code? And then on the server side it says hello world once and game script timeout. The game script that timed out is here:
local pos = Vector3.new(0,5,0) game.Workspace.ChildAdded:Connect(function(child) if child:FindFirstChild("Humanoid") then local cloud = game.ServerStorage.Cloud:Clone() while true do cloud.Parent = game.Workspace cloud.Position = child.Head.Position + pos if child.Humanoid.Health == 0 then cloud:Destroy() wait() end end end end)
The script just makes this cloud thats inside the character follow it above its head. I would like any optimizations and a possible fix. Also if you need screen shots I can provide them. Thanks!
There is only a wait() in an if statement. Try adding a wait in the actual while. Fixed code:
local pos = Vector3.new(0,5,0) game.Workspace.ChildAdded:Connect(function(child) if child:FindFirstChild("Humanoid") then local cloud = game.ServerStorage.Cloud:Clone() while true do cloud.Parent = game.Workspace cloud.Position = child.Head.Position + pos if child.Humanoid.Health == 0 then cloud:Destroy() end wait() end end end)