Thunder = "LocalScript"
Thunder2 = "LocalScript2"
WaterWheel = "WaterWheel"
Whirlpool = "Whirlpool"
Enbu = "Enbu"
BurningSun = "BurningSun"
function boop(Player)
if not Player.Backpack:FindFirstChild(Thunder)and(Thunder2) then
local Tool = game.ServerStorage[Thunder]:clone()
Tool.Parent = Player.Backpack
local Tool = game.ServerStorage[Thunder2]:clone()
Tool.Parent = Player.Backpack
if Player.Backpack:FindFirstChild(WaterWheel)and(Whirlpool)and(BurningSun)and(Enbu) then
Player.Backpack[WaterWheel]:Destroy()
Player.Backpack[Whirlpool]:Destroy()
Player.Backpack[Enbu]:Destroy()
Player.Backpack[BurningSun]:Destroy()
end
end
end
script.Parent.ClickDetector.MouseClick:Connect(boop)
enbu and burning sun are not remove when i click the part?
1 answer
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.
Thunder = "LocalScript"
Thunder2 = "LocalScript2"
WaterWheel = "WaterWheel"
Whirlpool = "Whirlpool"
Enbu = "Enbu"
BurningSun = "BurningSun"
function boop(Player)
if not Player.Backpack:FindFirstChild(Thunder) and not Player.Backpack:FindFirstChild(Thunder2) then
local Tool = game.ServerStorage[Thunder]:clone()
Tool.Parent = Player.Backpack
local Tool2 = game.ServerStorage[Thunder2]:clone()
Tool2.Parent = Player.Backpack
if Player.Backpack:FindFirstChild(WaterWheel)and Player.Backpack:FindFirstChild(Whirlpool)and Player.Backpack:FindFirstChild(BurningSun)and Player.Backpack:FindFirstChild(Enbu) then
Player.Backpack[WaterWheel]:Destroy()
Player.Backpack[Whirlpool]:Destroy()
Player.Backpack[Enbu]:Destroy()
Player.Backpack[BurningSun]:Destroy()
end
end
end
script.Parent.ClickDetector.MouseClick:Connect(boop)
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.
2 comments
it didn't work. there's an anyway to destroy it?
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.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
any errors?
You need to get in the habit of not deleting the indentation, it'll make debugging your own code so much easier.