#why isnt it effect all parts

50 messages · Page 1 of 1 (latest)

hearty sedge
#
local tableRad  = 4

local plr = game.Players.LocalPlayer
local hum = plr.Character:WaitForChild('Humanoid')

local MaxSeats = 6
local seatPlaced = 6

local v2
local LookV
local ChairPos
local ChairCF

local degrees   = 360/MaxSeats


    
for i = 0, seatPlaced do
    local part = Instance.new('Part', workspace.Folder)
    part.Size = Vector3.new(2,2,2)
    part.Anchored = true
    
    if i == 5 then
        for i , v in pairs(workspace.Folder:GetChildren()) do
            if v:IsA('Part') then
                while wait() do
                    local tablePos  = hum.Parent:WaitForChild('HumanoidRootPart').CFrame
                    v2 = (degrees) * seatPlaced
                    LookV = CFrame.Angles(math.rad(v2),0,0).LookVector
                    ChairPos  = tablePos * CFrame.new(LookV * tableRad)

                    ChairCF   = ChairPos * CFrame.Angles(math.rad(v2 + 180),0,math.rad(180))

                    v.CFrame = ChairCF
                end
            end
        end
    end
end
errant bone
#

what is the script supposed to do

hearty sedge
#

its pet movement

#

and it supposed to follow the player

#

and it follows but

#

not all the test parts

errant bone
#

what is it supposed to look like

oak cliff
hearty sedge
oak cliff
#

wait

hearty sedge
#

im sending a vid rn

oak cliff
#

i have made a script for that but in gui

#

for circular progressbars

hearty sedge
oak cliff
#

wait

errant bone
hearty sedge
#

alr

errant bone
#

its still not gonna be a circle though im not sure how the math for this works

hearty sedge
#

lets see

#

now its not follows

#

so loop is important

errant bone
#

it was in the wrong place

#
local tableRad  = 4

local plr = game.Players.LocalPlayer
local hum = plr.Character:WaitForChild('Humanoid')

local MaxSeats = 6
local seatPlaced = 6

local v2
local LookV
local ChairPos
local ChairCF

local degrees   = 360/MaxSeats



for i = 0, seatPlaced do
    local part = Instance.new('Part', workspace.Folder)
    part.Size = Vector3.new(2,2,2)
    part.Anchored = true

    if i == 5 then
        while wait() do
            for i , v in pairs(workspace.Folder:GetChildren()) do
                if v:IsA('Part') then
                    --while wait() do
                        local tablePos  = hum.Parent:WaitForChild('HumanoidRootPart').CFrame
                        v2 = (degrees) * i
                        LookV = CFrame.Angles(math.rad(v2),0,0).LookVector
                        ChairPos  = tablePos * CFrame.new(LookV * tableRad)

                        ChairCF   = ChairPos * CFrame.Angles(math.rad(v2 + 180),0,math.rad(180))

                        v.CFrame = ChairCF
                    --end
                end
            end
        end
        
    end
end

anyway this should work now (assuming the math is correct)

hearty sedge
#

ok

#

lol

#

wrong math

oak cliff
#

ok so

#

lemme fix bugs

#

annnd

#

done

hearty sedge
#

wth

oak cliff
#

:)

#

its working

hearty sedge
#

what is working

oak cliff
#

u dont see ?

hearty sedge
#

i see

oak cliff
#

the red is your dot

#

basically here, its script generated parts, but you get the point

#

now imagine i have this folder

#

and as you see its well placed

#
--!strict

local folder     = script.Parent
local main         = folder:WaitForChild('Main')

local SIZE         = 3
local SPACE        = 25

local function CreateDotsFromFolder(dots: Folder)

    local origin = main.Position + Vector3.new(
        main.Size.X / 2,
        main.Position.Y,
        main.Size.Z / 2
    )
    
    local i = 0
    local range = #dots:GetChildren()
    for _, dot: any in dots:GetChildren() do
        if not dot:IsA('Part') then continue end
        
        local aplha = (i / range) * math.pi * 2
        dot.Name = tostring(i)
        dot.Anchored = true
        dot.Position = Vector3.new(
            (math.cos(aplha) * SPACE) + origin.X,
            main.Position.Y,
            (math.sin(aplha) * SPACE) + origin.Z
        )
        i += 1
    end
end

CreateDotsFromFolder(workspace:WaitForChild('Dots'))
#

here is the script for it

#

so now for the final script @hearty sedge

#
--!strict

local sv = {}
sv.Players     = game:GetService "Players"

local folder     = workspace:WaitForChild('Dots')

local SPACE        = 25

local function CreateDotsFromFolder(main: BasePart, dots: {Instance})

    local origin = main.Position + Vector3.new(
        main.Size.X / 2,
        main.Position.Y,
        main.Size.Z / 2
    )
    
    local i = 0
    local range = #dots
    for _, dot: any in dots do
        if not dot:IsA('Part') then continue end
        
        local aplha = (i / range) * math.pi * 2
        dot.Anchored = true
        dot.Position = Vector3.new(
            (math.cos(aplha) * SPACE) + origin.X,
            main.Position.Y,
            (math.sin(aplha) * SPACE) + origin.Z
        )
        dot.Parent = main
        i += 1
    end
end

local CharacterAdded = function (character: Model)
    local hrp = character:WaitForChild('HumanoidRootPart')
    if not hrp:IsA('BasePart') then return end
    
    local hum = character:FindFirstChildOfClass('Humanoid')
    if not hum then return end
    
    local list = {}
    for _, parts in folder:GetChildren() do
        local clone = parts:Clone()
        clone.Parent = hrp
        table.insert(list, clone)
    end
    
    repeat task.wait(.1)
        CreateDotsFromFolder(hrp, list)
    until hum.Health <= 0
    
    for _, s in list do s:Destroy() end
end

local PlayerAdded = function (player: Player)
    player.CharacterAdded:Connect(CharacterAdded)
end

sv.Players.PlayerAdded:Connect(PlayerAdded)