Hello i’m making a my game, and i need my weapon can shoot on mobile/ipad
1.I wanna to achieve mobile/ipad players can shoot from weapon
-
I have no idea how ContextActionService works
-
I tryed to use Context ActionService and looked in youtube and i can’t find it anywhere
I’m using CO guns they need Carbon Engine installed.
Here is a gun script:
--// Services
local ts = game:GetService('TweenService')
local module = {
--// Positioning
RightArmPos = CFrame.new(-0.902175903, 0.745837986, -1.07592201, 1, 0, 0, 0, 1.19248806e-08, 1, 0, -1, 1.19248806e-08);
LeftArmPos = CFrame.new(0.698641002, 0.21109806, -1.96360207, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098);
GunPos = CFrame.new(0.239203155, -0.442340136, 1.38967824, 0.99999994, 0, 0, 0, -4.37113883e-08, -1, 0, 1, -4.37113883e-08);
SprintPos = CFrame.new(0, 0, 0, 0.748408914, -0.36141631, 0.556113422, 0.252163291, 0.930573106, 0.265419006, -0.613430977, -0.05841057, 0.787585199);
--// Fake Arm Positioning
FakeRightPos = CFrame.new(-0.947661817, 1.14884949, -1.26904488, 1, 0, 0, 0, 1.19248806e-08, 1, 0, -1, 1.19248806e-08);
FakeLeftPos = CFrame.new(1.05718744, 1.83566964, -1.67744327, 0.820266843, -0.0301536806, 0.571185529, -0.56725347, -0.171009913, 0.805592358, 0.0733867958, -0.984807789, -0.157378539);
FakeGripPos = CFrame.new(0.157520294, -0.226234198, 0.751968384, 1, 0, 0, 0, 1.19248806e-08, -1, 0, 1, 1.19248806e-08);
--// Ready Positions
ReadyHighPos = CFrame.new(0.800000012, -3, 0, 1, 1.03739011e-23, 0, -3.54808257e-24, 0.342020094, -0.939692616, -9.74827843e-24, 0.939692616, 0.342020094);
ReadyLowPos = CFrame.new(-0.249832153, 0.301519841, 0, 0.969846249, -0.220088065, 0.104687028, 0.173648179, 0.925416529, 0.336824059, -0.171010062, -0.308488846, 0.935729682);
--// Ammo Config
Ammo = 16;
StoredAmmo = 16;
MagCount = math.huge;
ExplosiveAmmo = 0;
--// Damage Config
BaseDamage = 45;
LimbDamage = 40;
ArmorDamage = 15;
HeadDamage = 90;
EShieldDamage = 10;
-- Recoil Config
gunRecoilMin = 20; -- How much the gun recoils backwards when not aiming
gunRecoilMax = 45; -- How much the gun recoils backwards when not aiming
AimGunRecoilMin = 6.5; -- How much the gun recoils backwards when aiming
AimGunRecoilMax = 14; -- How much the gun recoils backwards when aiming
KickbackMin = 5; -- Upward gun rotation when not aiming
KickbackMax = 7; -- Upward gun rotation when not aiming
AimKickbackMin = 2.5; -- Upward gun rotation when aiming
AimKickbackMax = 4.5; -- Upward gun rotation when aiming
SideKickMin = -3;
SideKickMax = 3;
AimSideKickMin = -2;
AimSideKickMax = 2;
CamShakeMin = 5;
CamShakeMax = 6;
AimCanShakeMin = 3;
AimCamShakeMax = 4;
--// Handling
Firerate = 60 / 720; -- 60 = 1 Minute, 700 = Rounds per that 60 seconds. DO NOT TOUCH THE 60!
FireMode = 1; -- 1 = Semi, 2 = Auto, 3 = Burst, 4 = Bolt Action, 5 = Shot, 6 = Explosive (Explosive is currently disabled)
--// Firemode Config
CanSelectFire = true;
BurstEnabled = false;
SemiEnabled = true;
AutoEnabled = true;
BoltAction = false;
ExplosiveEnabled = false;
--// Shot & Burst Config
BurstNum = 3; -- How many bullets per burst
ShotNum = 5; -- How many bullets per shot
--// Aim Config
AimZoom = 60;
AltAimZoom = 40;
AimZoomSpeed = 0.8;
AimSpeedMult = 10;
--// Mouse Config
MouseSensitivity = 0.5; -- Number between 0.1 and 1
SensitivityIncrement = 0.05; -- No touchy
-- Tracer Config
TracerTransparency = 0.3;
TracerLightEmission = 1;
TracerTextureLength = 1;
TracerLifetime = 0.12;
TracerFaceCamera = true;
TracerColor = BrickColor.new('Deep orange');
--// Bullet Physics
BulletPhysics = Vector3.new(0,55,0); -- Drop fixation: Lower number = more drop
BulletSpeed = 2000; -- Bullet Speed
BulletSpread = 0; -- How much spread the bullet has
ExploPhysics = Vector3.new(0,20,0); -- Drop for explosive rounds
ExploSpeed = 600; -- Speed for explosive rounds
BulletHopUpMult = 0.005; -- Hop up mutliplier
--// Calculations
TracerChance = 60;
--// Cosmetic
AntiTK = true;
MouseSense = 0.5;
CanAim = true;
CanBolt = true;
CanSlideLock = false;
CanAutoBolt = true;
LaserAttached = true;
LightAttached = true;
TracerEnabled = true;
SprintWalkIntensity = 0.18;
SprintWalkAnimSpeed = 15;
--// Explosive Settings
BlastPressue = 500000;
BlastRadius = 10;
DestroyJointRadius = 10;
ExplosionType = Enum.ExplosionType.NoCraters; -- Might wanna leave it like this
--// Laser Config
LaserColor = BrickColor.new('Lime green');
LaserEmission = 1;
LaserInfluence = 0;
LaserTransparency = NumberSequence.new(0.3);
--// Extras
RestMode = false;
AttachmentsEnabled = false;
UIScope = false;
--// Keybindings
ADSKeybind = Enum.UserInputType.MouseButton2;
AltADSKey = Enum.KeyCode.Z;
ShootKeybind = Enum.UserInputType.MouseButton1;
SprintKey = Enum.KeyCode.LeftShift;
CycleSightKey = Enum.KeyCode.T;
FireSelectKey = Enum.KeyCode.V;
ReloadKey = Enum.KeyCode.R;
PatrolKey = Enum.KeyCode.P;
LaserKey = Enum.KeyCode.L;
LightKey = Enum.KeyCode.K;
BoltKey = Enum.KeyCode.F;
--// Animations
IdleAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.25),{C1 = require(script).RightArmPos}):Play() -- require(script).FakeRightPos (For fake arms) | require(script).RightArmPos (For real arms)
ts:Create(objs[3],TweenInfo.new(0.25),{C1 = require(script).LeftArmPos}):Play() -- require(script).FakeLeftPos (For fake arms) | require(script).LeftArmPos (For real arms)
wait(0.18)
end;
FireModeAnim = function(char, speed, objs)
ts:Create(objs[1],TweenInfo.new(0.25),{C1 = CFrame.new(0.340285569, 0, -0.0787199363, 0.962304771, 0.271973342, 0, -0.261981696, 0.926952124, -0.268561482, -0.0730415657, 0.258437991, 0.963262498)}):Play()
wait(0.1)
ts:Create(objs[2],TweenInfo.new(0.25),{C1 = CFrame.new(0.67163527, -0.310947895, -1.34432662, 0.766044378, -2.80971371e-008, 0.642787576, -0.620885074, -0.258818865, 0.739942133, 0.166365519, -0.965925872, -0.198266774)}):Play()
wait(0.25)
objs[4]:WaitForChild("Click"):Play()
end;
ReloadAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.5),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.07592201, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509)}):Play()
ts:Create(objs[3],TweenInfo.new(0.5),{C1 = CFrame.new(0.511569798, -0.0621779114, -1.63076854, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098)}):Play()
wait(0.5)
local MagC = objs[4]:clone()
MagC:FindFirstChild("Mag"):Destroy()
MagC.Parent = objs[10]
MagC.Name = "MagC"
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = objs[5]
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[4].CFrame)
objs[4].Transparency = 1
objs[6]:WaitForChild("MagOut"):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.511569798, -0.0621778965, -2.69811869, 0.787567914, -0.220087856, 0.575584888, -0.51537323, 0.276813388, 0.811026871, -0.337826759, -0.935379863, 0.104581922)}):Play()
ts:Create(objs[2],TweenInfo.new(0.1),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.29060709, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509)}):Play()
wait(0.1)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.07592201, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509)}):Play()
wait(0.3)
objs[6]:WaitForChild('MagIn'):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.511569798, -0.0621779114, -1.63076854, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098)}):Play()
wait(0.4)
MagC:Destroy()
objs[4].Transparency = 0
if objs[7].C1 ~= CFrame.new() then
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.07592201, 0.98480773, -0.171010077, -0.0301536508, 0, -0.173647955, 0.984807789, -0.173648179, -0.969846308, -0.171009853)}):Play()
wait(0.3)
objs[7].Parent:WaitForChild('BoltForward'):Play()
ts:Create(objs[7],TweenInfo.new(0.03),{C1 = CFrame.new()}):Play()
ts:Create(objs[2],TweenInfo.new(0.1),{C1 = CFrame.new(-0.902175903, 0.395501226, -1.07592201, 0.98480773, -0.171010077, -0.0301536508, 0, -0.173647955, 0.984807789, -0.173648179, -0.969846308, -0.171009853)}):Play()
wait(0.15)
end
end;
BoltBackAnim = function(char, speed, objs)
ts:Create(objs[3],TweenInfo.new(0.25),{C1 = CFrame.new(-0.723402083, 0.561492503, -1.32277012, 0.98480773, 0.173648179, -2.07073381e-09, 0, 1.19248806e-08, 1, 0.173648179, -0.98480773, 1.17437144e-08)}):Play()
wait(0.1)
ts:Create(objs[2],TweenInfo.new(0.25),{C1 = CFrame.new(-0.674199283, -0.379443169, -1.24877262, 0.098731339, -0.973386228, -0.206811741, -0.90958333, -0.172570169, 0.377991527, -0.403621316, 0.150792867, -0.902414143)}):Play()
wait(0.4)
objs[5]:WaitForChild("BoltBack"):Play()
ts:Create(objs[2],TweenInfo.new(0.25),{C1 = CFrame.new(-0.674199283, -0.578711689, -0.798391461, 0.098731339, -0.973386228, -0.206811741, -0.90958333, -0.172570169, 0.377991527, -0.403621316, 0.150792867, -0.902414143)}):Play()
ts:Create(objs[1],TweenInfo.new(0.25),{C1 = CFrame.new(0, 0, 0.247189522, 1, 0, 0, 0, 1, 0, 0, 0, 1)}):Play()
ts:Create(objs[3],TweenInfo.new(0.25),{C1 = CFrame.new(-0.723402083, 0.311225414, -1.32277012, 0.98480773, 0.173648179, -2.07073381e-09, 0.0128111057, -0.0726553723, 0.997274816, 0.173174962, -0.982123971, -0.0737762004)}):Play()
wait(0.3)
end;
BoltForwardAnim = function(char, speed, objs)
objs[5]:WaitForChild("BoltForward"):Play()
ts:Create(objs[1],TweenInfo.new(0.1),{C1 = CFrame.new()}):Play()
ts:Create(objs[2],TweenInfo.new(0.1),{C1 = CFrame.new(-0.674199283, -1.50949407, -0.798391461, 0.098731339, -0.973386228, -0.206811741, -0.90958333, -0.172570169, 0.377991527, -0.403621316, 0.150792867, -0.902414143)}):Play()
ts:Create(objs[3],TweenInfo.new(0.2),{C1 = CFrame.new(-0.723402083, 0.653734565, -1.32277012, 0.98480773, 0.173648179, -2.07073381e-09, -0.00113785546, 0.00645311177, 0.999978542, 0.173644453, -0.98478663, 0.00655265898)}):Play()
wait(0.2)
end;
BoltingBackAnim = function(char, speed, objs)
ts:Create(objs[1],TweenInfo.new(0.1),{C1 = CFrame.new(0, 0, 0.247189522, 1, 0, 0, 0, 1, 0, 0, 0, 1)}):Play()
end;
BoltingForwardAnim = function(char, speed, objs)
ts:Create(objs[1],TweenInfo.new(0.1),{C1 = CFrame.new()}):Play()
end;
nadeReload = function(char, speed, objs)
ts:Create(objs[1], TweenInfo.new(0.6), {C1 = CFrame.new(-0.902175903, -1.15645337, -1.32277012, 0.984807789, -0.163175702, -0.0593911409, 0, -0.342020363, 0.939692557, -0.17364797, -0.925416529, -0.336824328)}):Play()
ts:Create(objs[2], TweenInfo.new(0.6), {C1 = CFrame.new(0.805950999, 0.654529691, -1.92835355, 0.787567914, -0.220087856, 0.575584888, -0.323594928, 0.647189975, 0.690240026, -0.524426222, -0.72986728, 0.438486755)}):Play()
wait(0.6)
ts:Create(objs[2], TweenInfo.new(0.6), {C1 = CFrame.new(0.805950999, 0.559619546, -1.73060048, 0.802135408, -0.348581612, 0.484839559, -0.597102284, -0.477574915, 0.644508123, 0.00688350201, -0.806481719, -0.59121877)}):Play()
wait(0.6)
end;
}
return module
Here is all gun controls:
ADSKeybind = Enum.UserInputType.MouseButton2;
AltADSKey = Enum.KeyCode.Z;
ShootKeybind = Enum.UserInputType.MouseButton1;
SprintKey = Enum.KeyCode.LeftShift;
CycleSightKey = Enum.KeyCode.T;
FireSelectKey = Enum.KeyCode.V;
ReloadKey = Enum.KeyCode.R;
PatrolKey = Enum.KeyCode.P;
LaserKey = Enum.KeyCode.L;
LightKey = Enum.KeyCode.K;
BoltKey = Enum.KeyCode.F;