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

How to check if my rocketlauncher exist?

Asked by 5 years ago
Edited 5 years ago
local gui = plr.PlayerGui
local Backpack = plr.Backpack
local stats = plr.leaderstats
local Cash = stats.Cash
local Rocket = plr.Character.RocketLauncher.Handle or plr.Backpack.RocketLauncher.Handle
if Rocket then
    if gui then
        if Cash.Value >= Amount.Value then
            Rocket.Mesh.TextureId = "rbxassetid://"..TextureId
            Cash.Value = Cash.Value - Amount.Value
            gui.Menu.ConfirmFolder.ConfirmLavaTexture.Visible = false 
            gui.Menu.TextureFrame.UnlockLavaTexture.Visible = false
        end
    end
end

output say that if i have the weapon in my character

17:23:17.268 - RocketLauncher is not a valid member of Backpack 17:23:17.269 - Stack Begin 17:23:17.269 - Script 'Players.LinkeeReiss.PlayerGui.Menu.ConfirmFolder.ConfirmLavaTexture.Yes.BuyScript', Line 10 17:23:17.269 - Stack End


output say that if it in my backpack

17:19:27.110 - RocketLauncher is not a valid member of Model 17:19:27.111 - Stack Begin 17:19:27.111 - Script 'Players.LinkeeReiss.PlayerGui.Menu.ConfirmFolder.ConfirmLavaTexture.Yes.BuyScript', Line 10 17:19:27.112 - Stack End

0
Add me on Discord: {}#7496 Opinality -2 — 5y

2 answers

Log in to vote
0
Answered by
vexound 170
5 years ago

Use the in-built function FindFirstChild() to see if the rocket launcher exists. Like this:

local Rocket = plr.Character:FindFirstChild("RocketLaunched")

if it doesn't exist then it'll return false but if it does then it returns true.

0
ok thank LinkeeReiss 10 — 5y
Ad
Log in to vote
-1
Answered by 5 years ago

I Know This Problem... Add me On Discord: {}#7496

0
Downvoted because this is not an answer hiimgoodpack 2009 — 5y

Answer this question