It’s because you changed it to a string, not an actual instance, which is why you can’t access it using .Value.
Fixed code:
local gasobject = script.Parent.Parent.GasObject
local db = false
script.Parent.ClickDetector.MouseClick:Connect(function(hit)
if not db then
local items = game.ServerStorage.Viruses:GetChildren()
local randomItem = items[math.random(#items)]
print(randomItem.Name)
db = true
script.Parent.Parent.GasInject.SFXDeploy.Playing = true
script.Parent.Parent.GasInject.SFXDeploy.TimePosition = 0.01
local cln = gasobject:Clone()
cln.Size = Vector3.new(5, 21.5, 22)
cln.Position = script.Parent.Parent.Robot.Torso.Position
cln.Anchored = false
cln.Virus.Value = randomItem.Value
cln.Parent = script.Parent.Parent
task.wait(3)
script.Parent.Parent.GasInject.SFXDeploy.Playing = false
db = false
task.wait(1)
cln:Destroy()
end
end)
--//Services
local ServerStorage = game:GetService("ServerStorage")
--//Variables
local Viruses = ServerStorage.Viruses
local partvirus = script.Parent.Virus
--//Functions
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and not hit.Parent:FindFirstChild("Injected") then
local char = hit.Parent
local cln = Instance.new("BoolValue")
cln.Parent = hit.Parent
cln.Name = "Injected"
if partvirus.Value == "V-B91N2" then
local VirusServerStorage = Viruses:WaitForChild(partvirus.Name)
for i = 1, 4 do
char.Head.Size += Vector3.one
task.wait(0.5)
end
local cln = VirusServerStorage.SFX:Clone()
cln.PlayOnRemove = true
cln.Parent = script.Parent
cln:Destroy()
char.Head:Destroy()
end
end
end)