Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to check if my rocketlauncher exist?

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

1 comment

0

Add me on Discord: {}#7496

2 answers

✓ Accepted answer

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.

1 comment

0

ok thank

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

1 comment

0

Downvoted because this is not an answer

This discussion is preserved as it was. New answers, comments, and votes are closed.