|
| 19 Apr 2015 10:16 AM |
So I'm using a script that someone gave me and and I've edited it:
local frame = script.Parent local num = frame.Players local template = frame.Player0 for i,player in pairs(game.Players:GetPlayers()) do if player then num.Value = num.Value + 1 local slotnum = num.Value local slot = template:Clone() slot.Parent = frame slot.Name = "Slot"..slotnum slot.Position = UDim2.new(0,0,0.05 * num.Value, 0) slot.Text = player.Name slot.Visible = true end end function Joining(player) num.Value = num.Value + 1 local slotnum = num.Value local slot = template:Clone() slot.Parent = frame slot.Name = "Slot"..slotnum slot.Position = UDim2.new(0,0,0.05 * num.Value, 0) slot.Text = player.Name slot.Visible = true end function Leaving(player) for i,label in pairs(frame) do if label then if string.find(label.Name,"Slot") then if label.Text == player.Name then label:Destroy() num.Value = num.Value - 1 end end end end end game.Players.PlayerAdded:connect(Joining) game.Players.PlayerRemoving:connect(Leaving)
But when someone leaves, it leaves a gap and then when someone joins, it puts their name on someone else and leaves that gap open |
|
|
| Report Abuse |
|
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 19 Apr 2015 10:35 AM |
Just tell the script to put the next open spot with a player name
if textbox = empty then textbox.text = player.name end
lold thats the general idea |
|
|
| Report Abuse |
|
|
| |
|
|
| 19 Apr 2015 10:49 AM |
| And how would I check the textlabel below it though |
|
|
| Report Abuse |
|
|
| |
|
|
| 19 Apr 2015 11:07 AM |
| I mean like, how would I set the empty text label to the players name thats in the slot beneath and then set the player beneath the next empty slot to that slot? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 19 Apr 2015 12:59 PM |
| Game.Forum.Scripters.PostHelp(true) |
|
|
| Report Abuse |
|
|
| |
|
|
| 19 Apr 2015 01:55 PM |
| Change the names to numbers, top being 10, bottom being 1, then do below=current-1 |
|
|
| Report Abuse |
|
|
|
| 22 Apr 2015 01:03 PM |
| And how would I do a for loop to change positions of everything thats below the one above? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 25 Apr 2015 06:38 AM |
This is my code so far:
This is what I'm working on
function Leaving(player) local slotnum = num.Value local below = nil local belowall = nil local current = nil local bottom = 1 local above = nil local top = 10 for i,label in pairs(frame) do if label then if string.find(label.Name,""..slotnum) then if label.Text == player.Name then current = label.Name below = current - 1 above = current + 1 for i in pairs (frame) do if string.find(label.Name,""..slotnum) <= below then belowall = top - slotnum for string.find(label.Name,"") end end label:Destroy() num.Value = num.Value - 1 end end end end end |
|
|
| Report Abuse |
|
|
|
| 25 Apr 2015 06:38 AM |
| I'm stuck on the for loop that finds all the slots beneath the one that got removed |
|
|
| Report Abuse |
|
|
|
| 25 Apr 2015 06:59 AM |
| http://wiki.roblox.com/index.php?title=Absolute_beginner%27s_guide_to_scripting |
|
|
| Report Abuse |
|
|
| |
|
|
| 25 Apr 2015 07:23 AM |
| we dont make 1337 scripts for free, noobcaik |
|
|
| Report Abuse |
|
|
| |
|