The script's intended purpose is to detect when its parent object is touched, then add 1 to an IntValue contained in StarterCharacterScripts. I get the aforementioned error on line 13. Shouldn't I be able to access the "Value" property like I can access "Color" and "Transparency" on things such as parts? And yes, I know there is a bit of spaghetti going on here.
stimPack = script.Parent local function onPartTouch(otherPart) local partParent = otherPart.Parent local humanoid = partParent:FindFirstChildWhichIsA("Humanoid") if humanoid then local character = humanoid.Parent local player = game.Players:GetPlayerFromCharacter(character) local stims = player:FindFirstChild("Stims") local stimvalue = stims.Value print(player, "has picked up a Syringe!") stimValue += 1 end end stimPack.Touched:Connect(onPartTouch)
line 12
local stims = player:FindFirstChild("Stims")
why are you searching inside the player when Stimsvalue is in the character
it would make more sense to do
local stims = character:FindFirstChild("Stims")