Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

How would i get this combo system to work?

Asked by 9 years ago

so im trying to make a combo system for my game. I want to make a script that fires when the player hits the mouse buttons in a certain order consecutivly. For example, i want a combo like Mouse1+Mouse2+Mouse2 = Combo. When they enter in this order it wil fire. This is what i have so far

01player = game.Players.LocalPlayer
02uis = game:GetService("UserInputService")
03uis.InputBegan:connect(function(key,procy)
04    if not proc then
05    local keys = uis:GetKeysPressed()
06  local needed = {"Mouse1","Mouse2","Mouse2"}
07        for i ,v in pairs(keys) do
08            if keys == needed then
09  print("I Got a Combo")
10            end
11        end
12    end
13  end)

This doesnt work at all and im not sure if I'm even doing it correctly >.>

1 answer

Log in to vote
2
Answered by
Hero_ic 502 Moderation Voter
9 years ago

Its not the best script but it works.

01local combo = 0 --First I will make combo variables
02local combo_limit = 1 --seconds until time left to press ends
03local combo_delay = .2 --seconds until the combo happens
04local combo_delay2 = .2 --seconds until the combo happens
05local combo_delay3 = .2 --seconds until the combo happens
06 
07game:GetService("RunService").RenderStepped:connect(function() --next we get renderstepped
08    if combo > 0 then --if its greater then 0 if it waits combo limit it = 0 again
09        wait(combo_limit)
10        combo = 0
11    end
12end)
13 
14game:GetService("UserInputService").InputBegan:connect(function(input , procy) --get input begin for combos
15    if not procy then
View all 33 lines...

if this helped please (upvote) and accept :D ~KIHeros

Ad

Answer this question