#When player joins...
171 messages · Page 1 of 1 (latest)
Yes no one have
is the table Round?
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
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
try it, looks fine
But there is a problem
the chairs do not turn to table
@toxic seal
how can we do that if we think in math
now do you use my script, or the one youve sent?
its perfectly eorking thx to you but
my keyboard 😦
@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)
CFrame can also set the orientation
Oh
so the chair is a model then chair:SetModelCFrame(ChairCF) right
ör
or
chair.PrimaryPart:SetModelCFrame(ChairCF)
whic one
How did you set the position before?
Its chair.PrimaryPart:SetModelCFrame(ChairCF)
I think
How can i sit the player to that chair
with code
I thin you just teleport and weld him to the chair,
Then play a sit animation
You don't really need a seat
Use WeldConstaint
RootPart
Jep
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)
Who said that
What
Ah np
there is two math.rad's if not work should i do -v to them or just one
** You are now Level 9! **
if one then which one
-v should just make it face the other way
So i have to use it in chaircf right
bro you are a god why dont you get scripter 3 or 2
I never asked, and I don't really need it
Wow
@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
local ChairPos = tablePos.Position + LookV * tableRad
--or you try :
local ChairPos = tablePos * CFrame.new(LookV * tableRad)
--if you want to be able to rotate it
also im 15
Show any decent scripts and if it’s decent then I’ll vouch you
still need to get into github and VSCode / Rojo but here is my Github (still working on it):
https://github.com/robbe8441?tab=repositories
@quiet spire you still there?
Vouch s1 @civic tinsel
what do i need to get s2 ?, like more projects or is my code just bad?
what script?
s
pls i need it
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)
but you said the rotation is set by
CFrame
so how is the pos gonna
rotate the
chair
one CFrame can set the position and Rotation, at the same Time
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
just ignore that, you dont use that ChairPos value
you use that ChairCF, and that has teh Rotation
that should work
could be worse
its possibe that your Pivot points are just diffrent,
first try something like : local ChairCF = ChairPos * CFrame.Angles(math.rad(v),0,0)
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?
jep
...
this is like getting right but not that much
if you look at the chairs rotation its like to table
but -45 degrees out
local ChairCF = ChairPos * CFrame.Angles(0,0,math.rad(v + 90)) maybe?
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)
local ChairCF = ChairPos * CFrame.Angles(math.rad(v + 90),0,0)
didnt we tried this
it is way better
but still
a prob
for the chairs
shoul we use -v
or
@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
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
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
pinged the wrong guy...