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 4 years ago
Edited 4 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:

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!

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

1 answer

Log in to vote
0
Answered by 4 years ago

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)
0
As for your "Hello World" issue, it is not this script. You may have a virus or another script causing that. NickIsANuke 217 — 4y
0
idk how but for the hello world thing most my scripts got reset ;-; as for this thanks it works CosmicIsGod 139 — 4y
0
no problem! NickIsANuke 217 — 4y
Ad

Answer this question