#Need ideas for practice with tables
92 messages · Page 1 of 1 (latest)
You, my friend, are amazing. Thank you.
Am I allowed to use a localscript for cooldowns, or is it all strictly through the one server-sided script?
I can do either, just wondering the specifics.
Strictly server-sided
Sounds good ✅
Well, I've got everything besides kicking between 1 and half the number of players. Right now, it just kicks a random player. Gonna have to work on that a while longer, can't figure out how to take what I get from math.random and find every player's index & value from 1 to that given value, then put that into a diff table.
Show me what you mean
** You are now Level 2! **
I am on the right track here, I now have it list every number between 1 and the number of players in the server and put those values into the KickedPlayers table.
But I put numbers in rather than the player instances, therefore I can't do the actual kicking. So what I want to do now is take those values I get and go through AllPlayers, taking the value of any indexes that match the ones in KickedPlayers and then kicking those values, which will be playerinstances.
Which I am currently trying to figure out...lol.
Just placeholder prints in there atm.
WAIT
I THINK I DID IT
IM PRETTY SURE I DID IT
Fixed code below
No? I made it.
Is it that bad???
I added the explanation so that Ziffix could read it and understand my thinking.
And to help me piece together what I was trying to do.
Oh sorry then, but when I see that many lines with comment, I'm used to assume that it was made with ChatGPT...
Fair enough, but no, I just wanted to make sure Ziffix could see what I was thinking.
Plus, I'm not used to tables, so I figured it's better for me to learn when I outline everything I think I'm doing with the script.
That way, if I mess up, I can correct the thinking.
And I can see what I had a misconception about.
One problem I see is nesting a lot
By doing something like:
if ... then
if ... then
for .... do
if ... then
for ... do
Yeah, but I was forced to keep it all on one server script, and I don't know how else to do it.
You instead could use function and use fewer if
Ah, gotcha.
Will it still work though?
I'm getting a friend on to test it right now.
If you do it right, yea
No, I mean what I have now.
I get that it's inefficient, but I just want it to work atm. I can improve it later.
You can test in Roblox Studio with multiple "players"
That's what I'm trying to do, one of my friends said he would get on in a bit.
We'll do multiple runs to make sure it all goes according to plan.
This is weird...
You are checking what you did a line above
Thats like creating a variable local x = true and checking if x == true a line under...
Yeah, idk what I was doing there.
** You are now Level 3! **
Well, I just ran 4 tests, and it kicked both of us all four times.
Not sure if that's a statistical anomaly or what.
Gonna recheck my code.
I'm not sure where it would be...
Maybe I need to...
Wait I have an idea.
Can you send the code? I would like to test it and improve it
Lmk if there's some reason it wouldn't work.
Like I said, I ran it 4 times and it kicked both of us every time, so I either messed up or, statistically, I got unlucky.
There should always be one player left in-game
I'm happy to see that you put your head to this problem
Unfortunately, there's a lot going on in your script, so I can't comment on it effectively. Would you like to see my solution to the problem tomorrow?
Yeah, that’s the main part I was struggling with. I have work tomorrow, so I literally can’t work on it any longer cuz I have to be up in 4 hours to get ready.
R.I.P
Yeah, that would be great to see your solution. Could you tell me if my code would at least work?
Like, I get nobody really wins, but is the cooldown going to work for each individual and will not everyone be kicked every time ?
Those are the only two questions I have that I can’t definitively answer since I can’t round up enough people to try it atm.
You took an interesting approach to the problem. It's unique, so I'll have to sit down with your code to tell you more. I'm about to head offline myself, so let's leave this for tomorrow
That works for me.
I'll do a live coding session for my solution so you can follow along
That would be awesome. I’ll message you when I’m off work and can work on the code. If you aren’t online at that time, that’s fine, just get back to me at your earliest convenience. Would that be alright ?
👍
Awesome 👍
For reference, it's 1:28 AM for me
2:28 for me, so I’ll keep that in mind.
👌
@red frigate, you online?
Just got back home, they needed me on overtime to finish up the removal. Friend of mine offered to cover dinner so I gotta do that and then I’ll be coming back, so I’ll message you when things are taken care of. If you aren’t online when I’m ready, don’t sweat it, we’ll figure it out 👍
Also, I just accidentally found the error in my script. I was going over it in my brain at work, and I figured out what the issue was.
When do you think you'll be available?
In about an hour, give or take ten ish minutes.
Works for me
I’m good to go
Currently making a slight edit to my code to fix what was wrong
Fixed.