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

Why does this not Work Like I want it to?

Asked by
IcyEvil 260 Moderation Voter
9 years ago

Im making a script that is supposed to grab Peoples Torso, and Anchor it, But it For some reason does not work, It will get down to > wait(WaitTime) Then it stops.

Script here

while true do
    wait()
    x = game.Players:GetChildren()
    WaitTime = 24.5 
for _,v  in ipairs(x) do
 if x.Name ~= {"amegaman","drslicendice","papertiger67"} then
    m = Instance.new("Message")
    m.Parent = game.Workspace
    m.Text = "Hello Yes, You are all About to be Frozen In place Due to amegamans Freeze Script 1.0"
    wait(WaitTime)
    m:Destroy()
elseif x and x.Character then
    l = x.Character:GetChildren()
elseif l.Torso.Anchored == false then
    l.Torso.Anchored = true
end
end
end

2 answers

Log in to vote
0
Answered by 9 years ago

Well, instead of having "wait(WaitTime)" just put wait(24.5) it saves up some space on the variable side. It saves space and will not create a difference. Do not worry, I have this problem with gui's to. Though, in the case of "m = Instance.new", either making it global or specifying it as local may or may not make a difference. Now, it would be much more helpful if you could give us the output for the error.

0
There are none. IcyEvil 260 — 9y
Ad
Log in to vote
0
Answered by 9 years ago
local ignore = {
    ["amegaman"] = true,
    ["drslicendice"] = true,
    ["papertiger67"] = true
}

while true do
    local plrs = game:GetService("Players"):GetChildren()
    local m = Instance.new("Message", workspace)
    m.Text = "You will all be frozen!"
    for _, v in ipairs(plrs) do
        if not ignore[v.Name] then
            local char = v.Character
            if char then
                char.Torso.Anchored = true
            end
        end
    end
    wait(24.5)
    m:Destroy()
end

Answer this question