Why is my add cream script not working?

Hello,

SO I am making this drink system and for part of it is that you can add some cream onto your drink. For some reason when I use the proximityprompt it runs the code but does not add the cream onto the drink.

I am confused on why it is not working cuz it prints out all of the prints.

game.Workspace.Cream.Model.main.Attachment.ProximityPrompt.Triggered:Connect(function(Plr)
	for i, v in pairs(Plr.Character:GetChildren()) do
		print("BBBAAA")
		if v:FindFirstChild("Handle") then
			print("BBBAAA")
			if v.Handle:FindFirstChild("Stats") then
				print("BBBAAA")
					print("BBBAAA")
				v.Handle.Cream.Transparency = 0
			end
		end
	end
end)

image

1 Like

replace to

if v:FindFirstChild("Stats") then

I think it’s better to put checking like this

for i, v in pairs(Plr.Character:GetChildren()) do
		print("BBBAAA")
		if v:IsA("Tool") and v.Name == "EmptyMilkshake Cup" then
			if v:FindFirstChild("Handle") then
				print("BBBAAA")
				if v:FindFirstChild("Stats") then
					print("BBBAAA")
					print("BBBAAA")
					v.Handle.Cream.Transparency = 0
				end
			end
		end
	end

I was going to do something like that but before you add the cream you have to put the milkshake in a blender which changes the name to the type u want so that will not work.

ohhh okay :slightly_smiling_face:

1 Like