Alright, if you dont know, any string array can have as many strings in it as you want, as long as you specify which number it is. for example, you cannot put in a string = the string array because it doesnt work that way, you have to specify which string in the string array you want to ad or change, like stringarray[2] or the next one after that is stringarray[3], the lowest is 0, so you may be wondering "how do i insert player names into different string arrays" well fun quick story, when i was new to scripting, i used math.random but that was stupid and the sloppiest idea ever, anyway, to do this, change the number everytime and be PREDICTABLE WHILE YOU DO IT, math .random isnt predictable and two numbers could be the same,
the quick answer? Just increment a value everytime a player is added so the numebr is always different and is 1 higher than the last. so your code should be like this (i added a value called num):
01 | local object = script.Parent |
02 | local fireObject = game.ReplicatedStorage.speedFire |
03 | local player = workspace |
04 | local allowedPlayers = ( "M9F" , "" ) |
08 | local function giveSpeed(hit) |
09 | if debounce = = false then |
11 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
12 | if hit.Parent.Name = = allowedPlayers [ num ] then |
14 | hit.Parent.Humanoid.WalkSpeed = 50 |
15 | hit.Parent.Humanoid.JumpPower = 75 |
16 | if not hit.Parent.Head:FindFirstChild( "speedFire" ) then |
17 | local clonedFire = fireObject:Clone() |
18 | clonedFire.Parent = hit.Parent.Head |
25 | object.Touched:Connect(giveSpeed) |
hope this helps :3
oh hold on i jsut realised i misunderstood the qustion, ok i understand now, lemme answer it correctly this time heheh sorry.
So your trying to test all of the player names in the string array to see if they math the player being tested. simple, make a pairs loop like this.
03 | for _,i in pairs (allowedPlayers) do |
05 | if not i = = hit.Parent.Name then |
15 | if failures = = #allowedPlayers then |