Hi. I'm trying to make a gun(The gun is a mesh) for my game But for some reason my code breaks in game. I'm using the collection service and the run service to detect if a players humanoidrootpart has the tag "D". It works in studio but in game it just breaks??

The error i get is this!

Error:

Players.Herobrinekid1.PlayerGui.LocalScript:69: attempt to index nil with 'Transparency'

And here is my code(In a Localscript by the way):

Code:

game:GetService("RunService").RenderStepped:Connect(function()
	if Gunme ~= nil then
		if Collectionse:HasTag(Player.Character.HumanoidRootPart, "D") then
			Gunme.Transparency = 0
		else
			Gunme.Transparency = 1
		end
	end
end)

3 comments

0

I don't think I have ever seen that error before, must be situational error.

0

What is a Gunme...? Looks like Gummy...

0

The error telled that the Gunme's properties doesn't contains something called Transparency, so the error could tell the Transparency is a nil thing... else you localed it. You'd rather change it to other things, or make the gun become parts.