#turn cycling system

1 messages · Page 1 of 1 (latest)

ocean vapor
#

So i made a script thats supposed to turn cycle between the npc and the player while they attack eachother sort of like pokemon. But I'm just confused on why this doesnt switch phases to attacking phase once the player chooses an attack?

heres my code:

#

ignore the timer and comments

spiral bone
#

create a remotevent and put this piece of code at the end of the loop for i, enemy in pairs(enemies)

#

mouse.Button1Down:Connect(function()
local target = mouse.Target
if target and enemy:IsAncestorOf(target) then
for _, a in pairs(allArrows) do
if a and a.Parent then
a:Destroy()
end
end
allArrows = {}
selectedEnemy = enemy

game.ReplicatedStorage.yourfolder:WaitForChild("RemoteEvent"):FireServer({
Move = selectedMove,
Target = selectedEnemy
})
end
end)