hewwo.
im traying to make a barrage in a OOP module
here is the a real quick look to the module script
this one is called StandMoves
local module = {}
module.__index = module
local basicsfolder = script.Parent.Basics
local somefunctions = script.Parent.SomeFunctions
local anchor = require(basicsfolder.Anchor)
local attributechange = require(basicsfolder.AttributeChange)
local visible = require(basicsfolder.Visible)
local transparency = require(basicsfolder.Transparency)
local trail = require(basicsfolder.Trail)
local standAura = require(basicsfolder.StandAura)
local valuechange = require(basicsfolder.ValueChange)
local velocity = require(basicsfolder.VelocityStuff)
local indicators = require(somefunctions.Indicators)
local coldowns = require(somefunctions.CooldownGuis)
local bareffect = require(somefunctions.beeffect)
local dmg = require(script.Parent.Damage)
local run = game:GetService("RunService")
function module.new(player)
local chr = player.Character
local human = chr.Humanoid
local rot = chr.HumanoidRootPart
local head = chr["Head"]
local ntorso = chr["Torso"]
local rightarm = chr["Right Arm"]
local leftarm = chr["Left Arm"]
local rightleg = chr["Right Leg"]
local leftleg = chr["Left Leg"]
local rot = chr["HumanoidRootPart"]
local stand = chr.Stand
local rot = stand:WaitForChild("StandHumanoidRootPart")
local hed = stand:WaitForChild("Stand Head")
local tors = stand:WaitForChild("Stand Torso")
local rarm = stand:WaitForChild("Stand Right Arm")
local larm = stand:WaitForChild("Stand Left Arm")
local rleg = stand:WaitForChild("Stand Right Leg")
local lleg = stand:WaitForChild("Stand Left Leg")
local spec = chr.Spec
local newmodule = {
["Standless"] = {
["Gun"] = function()
--code stuff
print("works2")
end
};
["TW"] = {
["Barrage"] = function(val)
local EHMMM = 0 --is to make a limit on the repeat until
local anim = human:LoadAnimation(rot.PunchBarrage)
local anim2 = human:LoadAnimation(rot.AttackPose)
if val == true then
chr:SetAttribute("Attacking", true)
chr:SetAttribute("activu", true)
anim:Play(0.1, 1, 1.7)
human.WalkSpeed = 2
chr:SetAttribute("BarrageValue", true)
task.spawn(function()
while val == true do
--barrage effect
task.wait(0.11)
if val == false then
chr:SetAttribute("BarrageValue", false)
end
end
end)
task.spawn(function()
while val == true do
--damage setup
EHMMM = EHMMM + 1
task.wait(0.1)
if val == false then
chr:SetAttribute("BarrageValue", false)
EHMMM = 0
human.WalkSpeed = 16
anim:Stop(0.1)
chr:SetAttribute("Attacking", false)
chr:SetAttribute("activu", false)
end
end
end)
print("began")
elseif val == false then
chr:SetAttribute("BarrageValue", false)
EHMMM = 0
human.WalkSpeed = 16
anim:Stop(0.1)
chr:SetAttribute("Attacking", false)
chr:SetAttribute("activu", false)
print("end")
end
end
};
}
setmetatable(newmodule, module)
return newmodule
end
function module:create(name, attack, val)
self[name][attack](val)
end
return module
if you can see, somewhere says Stand and youre be right that this is a jojo game
(kind of for now, bc i want to make more rather then make jojo stuff)
there other module script that is very similar to this one but is basicly the same, the only diference is the add of the stand.
i really try to make this work but i dont know how, because if you can see on this part of the local script of the ability:
local keybarrage = false --the "val" nil value on the function on the OOP function
local key1 = false --this doesnt matter but is to make a cooldown
function barragev1() --first way to try to call the barrage
if keybarrage == false then
keybarrage = true
move2:FireServer("TW", "Barrage", keybarrage)-- this is a fireserver, more later on the post you will saw how is the RemoteEvent script
elseif keybarrage == true then
keybarrage = false
move2:FireServer("TW", "Barrage", keybarrage)
end
end
function barragev2(c) --second try to call
move2:FireServer("TW", "Barrage", c)
end
UIS.InputBegan:Connect(function(input,gameprocessed)
if gameprocessed == true then return end
if checked.canattackb(plr) then return end
if input.KeyCode == Enum.KeyCode.E then
barragev2(true)
print("start")
end
end)
UIS.InputEnded:Connect(function(input,gameprocessed)
if gameprocessed == true then return end
if input.KeyCode == Enum.KeyCode.E then
barragev2(false)
print("end")
end
end)
without the functions on that local script, and putting just prints on that move from StandsMoves
replacing the damage setup and the repeat until, the InputBegan and InputEnded worked perfectly. but here the issue, when i try to test it and press E
you cant end the function on StandsMoves, there no ‘print(“end”)’ on that inputended
and the barrage effect never ends, (if you didnt notice, i want the barrage be holded by pressing the key, that why input began and ended) and the whole damage setup and repeat until only ends when the EHMMM is more then 45.
so what should i do?
make other module script for barrage and then call that function on StandsMove
or other thing?
(btw here how is the remote event script):
game.ReplicatedStorage.Combat.MoveCreate.OnServerEvent:Connect(function(player, a, b, c)
local myModule = require(game.ServerScriptService.damages.MoveSet)
local myNewModule = myModule.new(player)
myNewModule:create(a, b, c)
end)
game.ReplicatedStorage.Combat.StandMoveCreate.OnServerEvent:Connect(function(player, a, b, c)
local myModule = require(game.ServerScriptService.damages.MoveSet.StandMoves)
local myNewModule = myModule.new(player)
myNewModule:create(a, b, c)
end)