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

[SOLVED] I'm making a gun for my game. But the transparency breaks in game?

Asked by 4 years ago
Edited 4 years ago

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)
0
I don't think I have ever seen that error before, must be situational error. ffancyaxax12 181 — 4y
0
What is a Gunme...? Looks like Gummy... Xapelize 2658 — 4y
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. Xapelize 2658 — 4y

Answer this question