Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago
Edited 5 years ago

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:

01local pos = Vector3.new(0,5,0)
02 
03game.Workspace.ChildAdded:Connect(function(child)
04    if child:FindFirstChild("Humanoid") then
05        local cloud = game.ServerStorage.Cloud:Clone()
06            while true do
07                cloud.Parent = game.Workspace
08        cloud.Position = child.Head.Position + pos
09            if child.Humanoid.Health == 0 then
10                cloud:Destroy()
11                    wait()
12            end
13        end
14    end
15end)

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!

0
it could be because you could have collabarative script editing enabled or team create enabled? Harry_TheKing1 325 — 5y
0
I have team create but i turned off collabarative script editing CosmicIsGod 139 — 5y
0
maybe disable team create? or rewrite the script? Harry_TheKing1 325 — 5y
0
I tried to fix it. NickIsANuke 217 — 5y
0
Team create would not cause it NickIsANuke 217 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

There is only a wait() in an if statement. Try adding a wait in the actual while. Fixed code:

01local pos = Vector3.new(0,5,0)
02 
03game.Workspace.ChildAdded:Connect(function(child)
04    if child:FindFirstChild("Humanoid") then
05        local cloud = game.ServerStorage.Cloud:Clone()
06        while true do
07            cloud.Parent = game.Workspace
08            cloud.Position = child.Head.Position + pos
09            if child.Humanoid.Health == 0 then
10                cloud:Destroy()
11            end
12            wait()
13        end
14    end
15end)
0
As for your "Hello World" issue, it is not this script. You may have a virus or another script causing that. NickIsANuke 217 — 5y
0
idk how but for the hello world thing most my scripts got reset ;-; as for this thanks it works CosmicIsGod 139 — 5y
0
no problem! NickIsANuke 217 — 5y
Ad

Answer this question