#When player joins...

171 messages · Page 1 of 1 (latest)

quiet spire
#

I’ve no clue what you’re trying to do

worldly field
#

Yes no one have

toxic seal
#

is the table Round?

worldly field
#

@toxic seal

#

do you have any idea for this

toxic seal
#

maybe something like this ?

local tablePos     = Vector3....
local tableRad     = 5

local degrees     = 360
local seats       = 3

for i = 1, seats do
    local LookV = CFrame.Angles(0,math.rad((degrees/seats) * i),0).LookVector
    local ChairPos = tablePos + LookV * tableRad
end
#

for the chair Position

worldly field
#

Can it be like this

#

example

-- Configuration
local tableModel = game.Workspace.Table -- Replace "Table" with the actual name of your table model

-- Constants
local CHAIR_TAG = "Chair" -- Tag to identify chairs

-- Function to order chairs
local function orderChairs()
    local chairs = {}
    
    -- Find all chairs with the specified tag
    for _, chair in ipairs(game:GetService("CollectionService"):GetTagged(CHAIR_TAG)) do
        table.insert(chairs, chair)
    end
    
    -- Sort chairs based on their position
    table.sort(chairs, function(a, b)
        return a.Position.X < b.Position.X
    end)
    
    -- Rearrange chairs based on the sorted order
    for i, chair in ipairs(chairs) do
        chair:SetPrimaryPartCFrame(tableModel.PrimaryPart.CFrame * CFrame.new(i * 2, 0, 0)) -- Adjust the chair spacing as needed
    end
end

-- Function to add a chair to the table
local function addChair()
    -- Create a new chair
    local newChair = Instance.new("Part")
    newChair.Name = "Chair"
    newChair.Anchored = true
    newChair.Size = Vector3.new(1, 1, 1) -- Adjust the size of the chair as needed
    newChair.BrickColor = BrickColor.new("Medium blue") -- Adjust the color of the chair as needed
    newChair.Parent = tableModel
    game:GetService("CollectionService"):AddTag(newChair, CHAIR_TAG)
    
    -- Order the chairs
    orderChairs()
end

-- When a player joins
game.Players.PlayerAdded:Connect(function(player)
    -- Add a chair to the table
    addChair()
end)
#

its chat GPT by the way

toxic seal
#

try it, looks fine

worldly field
#

Yeah right

#

i also think its right

worldly field
#

@toxic seal

#

your script

#

is worked

#

...

worldly field
#

But there is a problem

#

the chairs do not turn to table

#

@toxic seal

#

how can we do that if we think in math

toxic seal
worldly field
#

Your ecript

#

script

worldly field
#

my keyboard 😦

#

@toxic seal

toxic seal
#

try something like this :

local tablePos     = Vector3
local tableRad     = 5

local degrees     = 360
local seats       = 3

for i = 1, seats do
    local v = (degrees/seats) * i
    local LookV = CFrame.Angles(0,math.rad(v),0).LookVector
    local ChairPos  = tablePos + LookV * tableRad
    local ChairCF   = CFrame.new(ChairPos) * CFrame.Angles(0,math.rad(v),0)
end
#

if its the wrong way then use math.rad(-v)

worldly field
#

Isnt it have to be chairs orientation

#

idk but

toxic seal
#

CFrame can also set the orientation

worldly field
#

Oh

#

so the chair is a model then chair:SetModelCFrame(ChairCF) right

#

ör

#

or

#

chair.PrimaryPart:SetModelCFrame(ChairCF)

#

whic one

toxic seal
#

How did you set the position before?

worldly field
#

Its chair.PrimaryPart:SetModelCFrame(ChairCF)

#

I think

#

How can i sit the player to that chair

#

with code

toxic seal
#

I thin you just teleport and weld him to the chair,
Then play a sit animation
You don't really need a seat

worldly field
#

Wow

#

So weld like

#

Instance.new("Weld")

toxic seal
#

Use WeldConstaint

worldly field
#

C0 to players torso?

#

or leg

toxic seal
#

RootPart

worldly field
#

ok

#

c1 to the models primary part (its seat union)

toxic seal
#

Jep

worldly field
#

And have to diable player movement

#

to not go up

toxic seal
#

If the chair is anchored, then you don't really need to,
But it can maybe fix some bugs

#

He's welded to the chair, he can't get up
(as long as you're not using roblox seats)

worldly field
#

Who said that

toxic seal
#

What

worldly field
#

Ah np

worldly field
junior tigerBOT
#

studio** You are now Level 9! **studio

worldly field
#

if one then which one

toxic seal
#

-v should just make it face the other way

worldly field
#

So i have to use it in chaircf right

#

bro you are a god why dont you get scripter 3 or 2

toxic seal
#

I never asked, and I don't really need it

worldly field
#

Wow

worldly field
#

idk if its wrong to ask but how old r u

#

@toxic seal

worldly field
#

@toxic seal

#

i have a problem

#

local tablePos = game.Workspace.Lobby.asd.roundtable:GetModelCFrame()
local tableRad = 5

local degrees = 360

game:GetService('ReplicatedStorage'):WaitForChild('Remotes').RemoteEvent.OnServerEvent:Connect(function()
local seats = #game:GetService('Players'):GetChildren()
for i = 1, seats do
local v = (degrees/seats) * i
local LookV = CFrame.Angles(0,math.rad(v),0).LookVector
local ChairPos = tablePos + LookV * tableRad

    local s = game:GetService('ServerStorage'):WaitForChild('Item').Chair:Clone()
    s.Parent = workspace.Lobby.asd
    s.PrimaryPart = s.Union
    local ChairCF   = CFrame.new(ChairPos) * CFrame.Angles(0,math.rad(v),0)
    s:SetPrimaryPartCFrame(ChairCF)
end

end)

#

and my script

toxic seal
mellow helmBOT
#
scrptr
Username
ID

1241577689

Account Created

<t:1568300134:F>

Description

I love to do scripts and games. :)

quiet spire
toxic seal
toxic seal
#

@quiet spire you still there?

toxic seal
#

what do i need to get s2 ?, like more projects or is my code just bad?

worldly field
#

@toxic seal

#

can you send me the script of fixed version

toxic seal
#

what script?

toxic seal
#

try that :

local tablePos  = game.Workspace.Lobby.asd.roundtable:GetModelCFrame()
local tableRad  = 5
local degrees   = 360


game:GetService('ReplicatedStorage'):WaitForChild('Remotes').RemoteEvent.OnServerEvent:Connect(function()
    local seats = #game:GetService('Players'):GetChildren()
    for i = 1, seats do
        local v = (degrees/seats) * i
        local LookV = CFrame.Angles(0,math.rad(v),0).LookVector
        local ChairPos  = tablePos * CFrame.new(LookV * tableRad)

        local s = game:GetService('ServerStorage'):WaitForChild('Item').Chair:Clone()
        s.Parent = workspace.Lobby.asd
        s.PrimaryPart = s.Union
        local ChairCF   = ChairPos * CFrame.Angles(0,math.rad(v),0)
        s:SetPrimaryPartCFrame(ChairCF)
    end
end)
worldly field
#

but you said the rotation is set by

#

CFrame

#

so how is the pos gonna

#

rotate the

#

chair

toxic seal
#

one CFrame can set the position and Rotation, at the same Time

worldly field
#

local ChairPos = tablePos * CFrame.new(LookV * tableRad)

#

so this would rotate to the table

#

are you sending messages?

#

oh shit i thoug my int go gg

toxic seal
#

just ignore that, you dont use that ChairPos value
you use that ChairCF, and that has teh Rotation

worldly field
#

ok

#

lol

#

@toxic seal

toxic seal
#

could be worse

worldly field
#

i changed the seats for 10 so dont worry

#

about copy

#

just

#

the pos

toxic seal
#

its possibe that your Pivot points are just diffrent,
first try something like : local ChairCF = ChairPos * CFrame.Angles(math.rad(v),0,0)

worldly field
#

like

#

local tablePos = game.Workspace.roundtable:GetModelCFrame()
local tableRad = 5
local degrees = 360
local seats = 10

game.Players.PlayerAdded:Connect(function()

for i = 1, seats do
    local v = (degrees/seats) * i
    local LookV = CFrame.Angles(0,math.rad(v),0).LookVector
    local ChairPos  = tablePos * CFrame.new(LookV * tableRad)

    local s = game:GetService('ServerStorage').Chair:Clone()
    s.Parent = workspace
    s.PrimaryPart = s.Union
    local ChairCF   = ChairPos * CFrame.Angles(math.rad(v),0,0)
    s:SetPrimaryPartCFrame(ChairCF)
end

end)

#

this?

toxic seal
#

jep

worldly field
toxic seal
#

...

worldly field
#

this is like getting right but not that much

#

if you look at the chairs rotation its like to table

#

but -45 degrees out

toxic seal
#

local ChairCF = ChairPos * CFrame.Angles(0,0,math.rad(v + 90)) maybe?

worldly field
#

lets try

#

its getting right

#

but

#

the chairs

#

float

toxic seal
#

its just me being dump again, i chnaged the Wrog Value

local tablePos  = game.Workspace.Lobby.asd.roundtable:GetModelCFrame()
local tableRad  = 5
local degrees   = 360


game:GetService('ReplicatedStorage'):WaitForChild('Remotes').RemoteEvent.OnServerEvent:Connect(function()
    local seats = #game:GetService('Players'):GetChildren()
    for i = 1, seats do
        local v = (degrees/seats) * i
        local LookV = CFrame.Angles(math.rad(v),0,0).LookVector
        local ChairPos  = tablePos * CFrame.new(LookV * tableRad)

        local s = game:GetService('ServerStorage'):WaitForChild('Item').Chair:Clone()
        s.Parent = workspace.Lobby.asd
        s.PrimaryPart = s.Union
        local ChairCF   = ChairPos * CFrame.Angles(0,math.rad(v + 90),0)  -- +90 is just to test, it (should) chnage the rotation
        s:SetPrimaryPartCFrame(ChairCF)
    end
end)
worldly field
#

@toxic seal

#

you are my hero pls help

#

i need

toxic seal
#

local ChairCF = ChairPos * CFrame.Angles(math.rad(v + 90),0,0)

worldly field
#

didnt we tried this

#

it is way better

#

but still

#

a prob

#

for the chairs

#

shoul we use -v

#

or

#

@toxic seal

toxic seal
#

you can just try a bit with changing those values
local ChairCF = ChairPos * CFrame.Angles(math.rad(v),0,0)
local ChairCF = ChairPos * CFrame.Angles(0,0,math.rad(v))
local ChairCF = ChairPos * CFrame.Angles(0,0,math.rad(v + 90))
local ChairCF = ChairPos * CFrame.Angles(90,0,math.rad(v))
thats just what im doing

worldly field
#

local ChairCF = ChairPos * CFrame.Angles(math.rad(v + 90),v,v)

#

could this work?

#

brooo

#

i have no math

#

i cant do

#

like

#

local ChairCF = ChairPos * CFrame.Angles(math.rad(v + 90),90,math.rad(v + 180))

#

i even tried

#

this

worldly field
#

local tablePos = game.Workspace.roundtable:GetModelCFrame()
local tableRad = 5
local degrees = 360
local seats = 10

game.Players.PlayerAdded:Connect(function()

for i = 1, seats do
    local v = (degrees/seats) * i
    local LookV = CFrame.Angles(math.rad(v - 180),0,0).LookVector
    local ChairPos  = tablePos * CFrame.new(LookV * tableRad)

    local s = game:GetService('ServerStorage'):WaitForChild('Chair'):Clone()
    s.Parent = workspace
    s.PrimaryPart = s.Union
    local ChairCF   = ChairPos * CFrame.Angles(math.rad(v + 90),0,0)  -- +90 is just to test, it (should) chnage the rotation
    s:SetPrimaryPartCFrame(ChairCF)
    warn(ChairCF)
end

end)

#

this did

#

@toxic seal

#

what should i try

#

??

#

@toxic seal DİD ITTTT

#

DID ITT

#

i did it

#

local tablePos = game.Workspace.roundtable:GetModelCFrame()
local tableRad = 5
local degrees = 360
local seats = 10

game.Players.PlayerAdded:Connect(function()

for i = 1, seats do
    local v = (degrees/seats) * i
    local LookV = CFrame.Angles(math.rad(v - 180),0,0).LookVector
    local ChairPos  = tablePos * CFrame.new(LookV * tableRad)

    local s = game:GetService('ServerStorage'):WaitForChild('Chair'):Clone()
    s.Parent = workspace
    s.PrimaryPart = s.Union
    local ChairCF   = ChairPos * CFrame.Angles(math.rad(v + 90),0,math.rad(90))  -- +90 is just to test, it (should) chnage the rotation
    s:SetPrimaryPartCFrame(ChairCF)
    warn(ChairCF)
end

end)

#
local tablePos  = game.Workspace.roundtable:GetModelCFrame()
local tableRad  = 5
local degrees   = 360
local seats = 10

game.Players.PlayerAdded:Connect(function()
    
    for i = 1, seats do
        local v = (degrees/seats) * i
        local LookV = CFrame.Angles(math.rad(v - 180),0,0).LookVector
        local ChairPos  = tablePos * CFrame.new(LookV * tableRad)

        local s = game:GetService('ServerStorage'):WaitForChild('Chair'):Clone()
        s.Parent = workspace
        s.PrimaryPart = s.Union
        local ChairCF   = ChairPos * CFrame.Angles(math.rad(v + 90),0,math.rad(90))  -- +90 is just to test, it (should) chnage the rotation
        s:SetPrimaryPartCFrame(ChairCF)
        warn(ChairCF)
    end
end)
#

this is the workin script

toxic seal
#

pinged the wrong guy...

worldly field
#

shit

#

sorry

#

Thank you

#

you can use it

#

ofcourse you can you did it