Posted
Hello, at the start I'd like to point out that I'm a complete begginer and I'm don't really know that much of lua.
So I'm trying to make an auto farm script where you spawn a clone (shadow), lock on in, attack it and ZVanish at the same time. (look code)
So this messy but still a working code which works. It spawns a clone and attacks it, just as it was supposed to do.
The thing is that im a dummy and I can't figure out how do I repeat the process of autofarming. After it kills the clone it won't spawn it again.
game:GetService("ReplicatedStorage").Core.Events.Character.SpawnShadow:FireServer()
game:GetService("ReplicatedStorage").Core.Events.Combat.LockOn:FireServer()
getgenv().autofarm = true
if getgenv().autofarm == true then
while wait() do
local args = {
[1] = "LightAttack",
[2] = 3
}
game:GetService("ReplicatedStorage").Core.Events.Combat.Attack:FireServer(unpack(args))
game:GetService("ReplicatedStorage").Core.Events.Combat.ZVanish:FireServer()
end
I have tried detecting if the clone hp is 0 or less but the problem is that it's kinda complicated since when u spawn the clone it shows up in a
game:GetService("Workspace").SpawnedCharacters
where all the player models are and also clones of players who spawned clones.
These are players and the random numbers are clones. Each player has a different clone name. This makes it hard to localize the local player clone. And since I dont want it to be only for my use, I'm wondering how do I make it work if other player is using the script (reminder: each player's clone has different name).
I hope someone understood and helps me solve it, I'm not really good at explaining but I tried my best.
Replied
use loops like
repeat wait()
game:GetService("ReplicatedStorage").Core.Events.Character.SpawnShadow:FireServer()
game:GetService("ReplicatedStorage").Core.Events.Combat.LockOn:FireServer()
getgenv().autofarm = true
if getgenv().autofarm == true then
while wait() do
local args = {
[1] = "LightAttack",
[2] = 3
}
game:GetService("ReplicatedStorage").Core.Events.Combat.Attack:FireServer(unpack(args))
game:GetService("ReplicatedStorage").Core.Events.Combat.ZVanish:FireServer()
end
until false
Cancel
Post
#Road To 10 Rep
https://cdn.discordapp.com/attachments/1091702141871210517/1099702036041318450/WRDBanner_hostedUser_1.png siggy by B00M
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post