Ad
Log in to vote
0

Why does this LocalScript not work...?

Asked by
IcyEvil 261 Moderation Voter
3 years ago

Trying to make a selectionBox in the torso But it seems to hate me.

while wait() do
    for _,v in pairs(game.Players.LocalPlayer:GetChildren()) do
    end end

local outline = Instance.new("SelectionBox")
  local t = v.Character:findFirstChild("Torso")
if t then outline.Adornee = t
end


1 answer

Log in to vote
0
Answered by
Defaultio 160
3 years ago

You goof, you didn't even put the selection box code in the loops! You've got your two ends immediately after your while and for lines. This means that the code between while wait() do and the last end run continuously, and the code between for _,v in pairs(game.Players.LocalPlayer:GetChildren()) do and the first end run continuously for each player.

Because this is run continuously, you never even get out of the loops to reach your selection box code, 5-8. Put that chunk of code before the two ends, and you should be golden.

Ad

Answer this question