Strike System help

Hello Developers!

I am trying to setup a application center for my group, I have a ranking api and everything but I am trying to setup a system were if they got it wrong it will add a X to there score. I am super confused. I can get it to the second strike but I dont know how to make it to the 3rd strike because I cant use another else statement.

Current script:

local Answer = script.Parent.Parent.Click3.Text == "X"

if Answer then

print("Passed")

else if script.Parent.Parent.Parent.XRed.Visible == true then

script.Parent.Parent.Parent.XXRed.Visible = true

else

script.Parent.Parent.Parent.XRed.Visible = true

end

end

if script.Parent.Parent.Parent.XXRed.Visible == true then

script.Parent.Parent.Visible = false

script.Parent.Parent.Parent.Results.FAILED.Visible = true

script.Parent.Parent.Parent.Results.RESULT.Text = "Unfortunately you have failed your application due to Having Max Fails! You may apply again."

script.Parent.Parent.Parent.Results:TweenPosition(UDim2.new(0.26, 0, 0.222, 0))

wait(15)

player:Kick("Unfortunately you have failed your application due to Having Max Fails! You may apply again.")

end

Can anyone help?

1 Like

Cant you just use a integer?
Just add to to it everytime someone gets something wrong and if its >= 3 then kick the player.

If you wanna get fancy use a intvalue and .Changed to detect the change.

I would and that was my first Idea but I cant figure out how to use it and implement it will my strike system.

This seems like a pretty advanced project for you then, just judging your scripting experience.

You would implement it like so:

  1. Have a integer value in the script
  2. Index is like local value = script.StrikeAmount
  3. When you want to add a strike do
value.Value = value.Value + 1
  1. Detect changes as followed
value.Changed:Connect(function()
       if value.Value == 1 then
               --Code here
       end
       --Repeat 2 other times.
end)

Ok! Thanks for the help! I will start working on it.

1 Like