[FIXED]Local Script Doesnt detect Tool with FindFirstChild

  1. What i want is when the player already have the item,the script disable will be true

  2. The FindFirstChild in my Script doesnt work

3.I tried Searching it but no solution appears,I tried using Remote Event but it still didnt work

The local script is in a Button and the Tool is in Replicated Storage,Theres no Error Appearing.
When i click the button,The tool duplicate instead of making the script

player = game.Players.LocalPlayer

if player.leaderstats.Coins.Value >10 then --10 is the price
player.leaderstats.Value = player.leaderstats.Value -10 --it decrease the coins
player.Scale.Potion.Value = player.Scale.Potion.Value +1 --for my lock script
script.Parent.TextLabel.Visible = false --just a text
script.Parent.ImageLabel.Visible = false --just a text
script.Parent.Condition.Visible = true --just a text
script.Parent.Condition.Text = ‘Purchase Successful’
game.ReplicatedStorage.Potion.Shop1[“Orange Potion”]:Clone().Parent = player.Backpack – it clones the tool
script.Disabled = true
script.Disabled = false
script.Parent.Condition.Visible = false
script.Parent.TextLabel.Visible = true
elseif player:WaitForChild(“Backpack”):FindFirstChild(“Orange Potion”) or player.Character:FindFirstChild(“Orange Potion”) then
script.Disabled = true --it disable the script



The problem is the FindFirstChild i Think

1 Like

Please use the correct LUA format.

The problem is you are trying to disable the script from within itself which is not a good idea, instead you should make another script that disable that script.

1 Like

Im a begginer at scripting but im gonna do that

I wish you luck, but once you get more into scripting it is very fun. :slight_smile:

  1. You are not using the code blocks
  2. You can’t re-enable the script after disabling it
  3. Disabling must be done from the server

Edit : A script can be re-enabled only from another script.

If the problem is in FindFirstChild then it means that the tool is not loaded while the script has already been loaded…
In that case try using WaitForChild, it waits until the tool loads.

Try this:-
player:WaitForChild(“Backpack”):WaitForChild(“Orange Potion”) or player.Character:WaitForChild(“Orange Potion”)

He literally disables the script and re-enables it :thinking:

Thats How i make CoolDown for my Script

I fixed it,What i did is i made a tool in starter pack so that players dont buy it,pretty Lazy fix