Context Action Service conflicts with tool.activated, i researched inside my game by enabling and disabling scripts and the one that had this lines of code was the issue:
cas:BindAction("M1",M1,true,Enum.UserInputType.MouseButton1,Enum.KeyCode.ButtonR1)
cas:BindAction("M2",M1,true,Enum.UserInputType.MouseButton1,Enum.KeyCode.ButtonR2)
Tried disabling the script and it worked also deleted the line but i need the mouse button 1 for my attacks so i couldn’t find a great solution.
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local cas = game:GetService("ContextActionService")
local Available = Char:WaitForChild("Available")
local UIS = game:GetService("UserInputService")
local fx = require(game.ReplicatedStorage.Modules.FX)
local ctrlHold = false
local onPhone = UIS.TouchEnabled
local db = false
local db2 = false
local db3 = false
local db4 = false
local PrepAnim = Instance.new("Animation")
PrepAnim.AnimationId = "rbxassetid://7967648696"
local PlayAnim = Char.Humanoid:LoadAnimation(PrepAnim)
function Ki(actionName, inputState)
if Char.Stats.Ki.Value > 5 and Available and not db and inputState == Enum.UserInputState.Begin then
db = true
game.ReplicatedStorage["Ki Blast"]:FireServer(Player:GetMouse().Hit.LookVector*100)
Wait(.3)
db = false
end
end
function M1(actionName, inputState)
if not db2 and Available.Value == true and inputState == Enum.UserInputState.Begin and not ctrlHold then
db2 = true
game.ReplicatedStorage["Punch"]:FireServer(Char.LockOn.Value)
Wait(.4)
db2 = false
end
if not db3 and Available.Value == true and inputState == Enum.UserInputState.Begin and not onPhone and ctrlHold then
db3 = true
game.ReplicatedStorage["Hard Punch"]:FireServer()
wait(1)
db3 = false
elseif not db3 and Available.Value == true and inputState == Enum.UserInputState.Begin and onPhone and actionName == "M2" then
db3 = true
game.ReplicatedStorage["Hard Punch"]:FireServer()
wait(1)
db3 = false
end
end
function Block(actionName, inputState)
if not db4 and Available.Value == true and inputState == Enum.UserInputState.Begin then
game.ReplicatedStorage.Block:InvokeServer(false)
Char.Available.Value = false
PlayAnim:Play()
elseif inputState == Enum.UserInputState.End then
db4 = true
PlayAnim:Stop()
game.ReplicatedStorage.Block:InvokeServer(true)
Char.Available.Value = true
wait(.5)
db4 = false
end
end
UIS.InputBegan:Connect(function(key,no)
if not no then
if key.KeyCode == Enum.KeyCode.LeftControl then
ctrlHold = true
end
end
end)
UIS.InputEnded:Connect(function(key,no)
if not no then
if key.KeyCode == Enum.KeyCode.LeftControl then
ctrlHold = false
end
end
end)
cas:BindAction("Ki",Ki,true,Enum.KeyCode.E,Enum.KeyCode.ButtonA)
cas:BindAction("M1",M1,true,Enum.UserInputType.MouseButton1,Enum.KeyCode.ButtonR1)
cas:BindAction("M2",M1,true,Enum.UserInputType.MouseButton1,Enum.KeyCode.ButtonR2)
cas:BindAction("Block",Block,true,Enum.KeyCode.F,Enum.KeyCode.ButtonL2)
cas:SetTitle("Ki","Ki Blast")
cas:SetTitle("M1","M1")
cas:SetTitle("M2","M2")
cas:SetTitle("Block","Block")
cas:SetPosition("Ki", UDim2.new(1, -70, 0, 10))
cas:SetPosition("M1", UDim2.new(1, -135,0, 30))
cas:SetPosition("M2", UDim2.new(1, -155,0, 90))
cas:SetPosition("Block", UDim2.new(1, -200,0, 30))
When the script of the Context action service is enabled this tool script doesn’t work