Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

why is region3 not being set to plrs uppertorsos cframe??

Asked by
tacotown2 119
5 months ago
game.Players.PlayerAdded:Connect(function(plr)
local region = Region3.new(Vector3.new(1,1,1), Vector3.new(10,10,10))
region.CFrame = game.Workspace.Darkwolfgameryr.UpperTorso.CFrame
region.Size = game.Workspace.Darkwolfgameryr.UpperTorso.Size
local part = Instance.new("Part")
part.Anchored = true
part.BrickColor = BrickColor.new("Black")
part.Transparency = 0.5
part.CanCollide = false
part.Size = region.Size
part.CFrame = region.CFrame
part.Parent = workspace

while true do
    wait(1)
    local partsInRegion = workspace:FindPartsInRegion3(region, part, 1000)
    for i, part in pairs (partsInRegion) do
        if part.Parent:FindFirstChild("Tool") ~= nil  and part.Parent:FindFirstChild("UpperTorso") ~= nil then
            part.Parent.UpperTorso.Transparency = 1
            print("works")
        end
    end
    end
end)

region3 is supposed to be in the players uppertorso but it not working but when i remove the playeradded event and the region.cframe and region.size it works again but how do i make this work?

0
why do you need the region check loop in a playeradded event? ForeverBrown 72 — 5mo
0
With the parts in region you can have it running constantly instead of trying to have a loop per each player. It will detect all parts in the region and from that you can determine the number of players in the region. ForeverBrown 72 — 5mo
0
what thats not even what i want tacotown2 119 — 5mo

Answer this question