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

enbu and burning sun are not remove when i click the part?

Asked by 5 years ago
Edited 5 years ago
01    Thunder = "LocalScript"
02Thunder2 = "LocalScript2"
03WaterWheel = "WaterWheel"
04Whirlpool = "Whirlpool"
05Enbu = "Enbu"
06BurningSun = "BurningSun"
07 
08function boop(Player)
09 if not Player.Backpack:FindFirstChild(Thunder)and(Thunder2) then
10  local Tool = game.ServerStorage[Thunder]:clone()
11  Tool.Parent = Player.Backpack
12 local Tool = game.ServerStorage[Thunder2]:clone()
13  Tool.Parent = Player.Backpack
14    if Player.Backpack:FindFirstChild(WaterWheel)and(Whirlpool)and(BurningSun)and(Enbu) then
15    Player.Backpack[WaterWheel]:Destroy()
View all 22 lines...
0
any errors? NickAtNick 163 — 5y
0
You need to get in the habit of not deleting the indentation, it'll make debugging your own code so much easier. SteamG00B 1633 — 5y

1 answer

Log in to vote
0
Answered by
SteamG00B 1633 Moderation Voter
5 years ago
Edited 5 years ago

2 mistakes you made in here and I'm assuming your other 2 local scripts:

You cannot have an if statement like if this==0 and 1 and 2 you have to check if this==0 and if this==1 and if this==2

The other mistake is you tried to instantiate 2 different things under the same variable name, not only is this not allowed, if it were possible, it would wipe the first variable once you set it again to something else. And although you will most likely be doing this in the future (the correct way), it will be in controlled cases where you do actually want this to happen.

Also third "mistake" is that you removed the automatic indentation and added your own indents using spaces. Never use spaces to indent on roblox because it messes up auto indent.

01Thunder = "LocalScript"
02Thunder2 = "LocalScript2"
03WaterWheel = "WaterWheel"
04Whirlpool = "Whirlpool"
05Enbu = "Enbu"
06BurningSun = "BurningSun"
07 
08function boop(Player)
09    if not Player.Backpack:FindFirstChild(Thunder) and not Player.Backpack:FindFirstChild(Thunder2) then
10        local Tool = game.ServerStorage[Thunder]:clone()
11        Tool.Parent = Player.Backpack
12        local Tool2 = game.ServerStorage[Thunder2]:clone()
13        Tool2.Parent = Player.Backpack
14        if Player.Backpack:FindFirstChild(WaterWheel)and Player.Backpack:FindFirstChild(Whirlpool)and Player.Backpack:FindFirstChild(BurningSun)and Player.Backpack:FindFirstChild(Enbu) then
15            Player.Backpack[WaterWheel]:Destroy()
View all 23 lines...

I've only fixed what I've been able to see from this script, if it doesn't work, then it will be something wrong with the objects you are referencing.

Given what you've provided, this should answer your question, accept this as the solution to your problem if you are satisfied, but if not, then just say so and I will help you further.

0
it didn't work. there's an anyway to destroy it? TaTzuto12 1 — 5y
0
What I just showed you was how you destroy it, if it didn't work, that is probably because you don't have anything in your backback under the names you provided. SteamG00B 1633 — 5y
Ad

Answer this question