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

How to make gun shoot on mobile/Ipad?

Asked by 3 years ago
Edited 3 years ago

I'm new in scripting so i have no idea how to make my gun shoot, i tryed to use Context Action Service, but i'm not good in it. Also i watched a youtube videos, but can't find a way to fix my problem

Gun Config Script: ! //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;

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 !

Answer this question