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

Scripts resetting to print("Hello World!") upon game loading?

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!

5 comments

0

it could be because you could have collabarative script editing enabled or team create enabled?

0

I have team create but i turned off collabarative script editing

0

maybe disable team create? or rewrite the script?

0

I tried to fix it.

0

Team create would not cause it

1 answer

✓ Accepted answer

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)

3 comments

0

As for your "Hello World" issue, it is not this script. You may have a virus or another script causing that.

0

idk how but for the hello world thing most my scripts got reset ;-; as for this thanks it works

0

no problem!

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