hello! im trying to give a player a plate. would this be the most efficient way of doing it? so if a player sits in chair 1, the attribute playerName in the seat and the plate will have the players name.
ty 4 the help!
if randomSeat.Name == "chair1" then
plate = workspace.plate1
plate:SetAttribute("playerName", randomSeat.Occupant.Parent.Name)
end
elseif randomSeat.Name == "chair2" then
plate = workspace.plate2
plate:SetAttribute("playerName", randomSeat.Occupant.Parent.Name)
end
so far it stores the player name in the seat but i cant get it to do the plate:
function startGameModule.startGameFunction()
game.Players.PlayerAdded:Connect(function(p)
wait(3)
local c = p.Character
local seatOFFSET=CFrame.new(0,2,0)
local seatFolder = workspace.tableModel.seatFolder
local hum:Humanoid = c.Humanoid
randomSeat = seatFolder:GetChildren()[math.random(1, #seatFolder:GetChildren())]
if randomSeat:GetAttribute("occupied") == false then
c:PivotTo(randomSeat.CFrame* seatOFFSET)
wait()
randomSeat:Sit(hum)
if randomSeat.Occupant then
randomSeat:SetAttribute("occupied", true)
randomSeat:SetAttribute("playerName", randomSeat.Occupant.Parent.Name)
print(randomSeat.Name)
end
end
end)
end