Im trying to bind two actions to the same keys, using context action. Both actions are in separate scripts. Ill post them in priority order. The priority 2 action runs, but priority 1 never runs, so you arent able to reload, but can revive players. The button in question is for Xbox Enum.KeyCode.ButtonX
– This is the first one, its ran first because its conditional.
– playerRevive and reviveBar are both false by default.
function module:startPickup(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
if self.playerRevive and self.reviveBar then
local revive = 0
self.reviving = self.playerRevive
task.spawn(function()
while self.reviving and self.playerRevive and self.reviveBar do
if revive == 100 then
self.Global.Filtering.playerRevive:FireServer(self.reviving)
self.reviving = false
warn('Player revive complete.')
else
self.reviveBar.TitleFrame.ReviveBar.Size = UDim2.new(revive/100,0,1,0)
revive = revive + 1
end
wait(0.05)
end
end)
return Enum.ContextActionResult.Sink
end
elseif inputState == Enum.UserInputState.End then
if self.reviving then
self.reviveBar.TitleFrame.ReviveBar.Size = UDim2.new(0,0,1,0)
self.reviving = false
end
end
return Enum.ContextActionResult.Pass
end
contextActionService:BindActionAtPriority("Interact", function(...)
self:startPickup(...)
end, false, 2 , Enum.KeyCode.E, Enum.KeyCode.ButtonX)
– This second one is ran second as its not conditional, and i want it to run only if player isnt reviving.
function startReload(self, actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
self.AnimateModule:Reload()
end
return Enum.ContextActionResult.Sink
end
contextActionService:BindActionAtPriority("Reload", function(...) startReload(self, ...) end, false, 1, Enum.KeyCode.R, Enum.KeyCode.ButtonX)
Changing the priority order DOES make reloading work, but makes reviving not work.