Drink system not working

I was scripting a drink system and decided to use proximity prompt, but the proximity promt wont even show up? Is it a problem with the script or game?

local DrinkMachine = script.Parent
local TouchPart = DrinkMachine.TouchPart
local FakeCup = DrinkMachine.MachineCup
local DrinkName = "e" --name of drink -- CHANGE AT LINE 50 TOO

script.Parent.Triggered:Connect(function(player)
	local Cup = player.Parent
	local Character = Cup.Parent
	
	if Cup.Name == "Empty Cup" then
		Cup.Parent = game.ReplicatedStorage
		FakeCup.Cup.Transparency = 0
		FakeCup.LidGroup.Lid.Transparency = 0
		FakeCup.LidGroup.NeonBig.Transparency = 0
		FakeCup.LidGroup.NeonSmall.Transparency = 0
		wait(0.5)
		FakeCup.DrinkFall.Transparency = 0
		FakeCup.DrinkGroup.Drink1.Transparency = 0
		wait(.3)
		FakeCup.DrinkGroup.Drink1.Transparency = 1
		FakeCup.DrinkGroup.Drink2.Transparency = 0
		wait(.3)
		FakeCup.DrinkGroup.Drink2.Transparency = 1
		FakeCup.DrinkGroup.Drink3.Transparency = 0
		wait(.3)
		FakeCup.DrinkGroup.Drink3.Transparency = 1
		FakeCup.DrinkGroup.Drink4.Transparency = 0
		wait(.3)
		FakeCup.DrinkGroup.Drink4.Transparency = 1
		FakeCup.DrinkGroup.Drink5.Transparency = 0
		wait(.3)
		FakeCup.DrinkGroup.Drink5.Transparency = 1
		FakeCup.DrinkGroup.Drink6.Transparency = 0
		wait(.3)
		FakeCup.DrinkGroup.Drink6.Transparency = 1
		FakeCup.DrinkGroup.Drink7.Transparency = 0
		wait(.3)
		FakeCup.DrinkGroup.Drink7.Transparency = 1
		FakeCup.DrinkGroup.Drink8.Transparency = 0
		wait(.3)
		FakeCup.DrinkGroup.Drink8.Transparency = 1
		FakeCup.Cup.Transparency = 1
		FakeCup.LidGroup.Lid.Transparency = 1
		FakeCup.LidGroup.NeonBig.Transparency = 1
		FakeCup.LidGroup.NeonSmall.Transparency = 1
		FakeCup.DrinkFall.Transparency = 1

		Cup.Parent = Character
		Cup.Drink.Transparency = 0
		Cup.Name = "e" --CHANGE NAME HERE
	
	elseif Cup.Name == "Empty Cup w/ Ice" then
		Cup.Parent = game.ReplicatedStorage
		FakeCup.Cup.Transparency = 0
		FakeCup.LidGroup.Lid.Transparency = 0
		FakeCup.LidGroup.NeonBig.Transparency = 0
		FakeCup.LidGroup.NeonSmall.Transparency = 0
		FakeCup.IceGroup.Ice1.Transparency = 0
		FakeCup.IceGroup.Ice2.Transparency = 0
		FakeCup.IceGroup.Ice3.Transparency = 0
		wait(0.5)
		FakeCup.DrinkFall.Transparency = 0
		FakeCup.DrinkGroup.Drink1.Transparency = 0
		wait(.3)
		FakeCup.DrinkGroup.Drink1.Transparency = 1
		FakeCup.DrinkGroup.Drink2.Transparency = 0
		wait(.3)
		FakeCup.DrinkGroup.Drink2.Transparency = 1
		FakeCup.DrinkGroup.Drink3.Transparency = 0
		wait(.3)
		FakeCup.DrinkGroup.Drink3.Transparency = 1
		FakeCup.DrinkGroup.Drink4.Transparency = 0
		wait(.3)
		FakeCup.DrinkGroup.Drink4.Transparency = 1
		FakeCup.DrinkGroup.Drink5.Transparency = 0
		wait(.3)
		FakeCup.DrinkGroup.Drink5.Transparency = 1
		FakeCup.DrinkGroup.Drink6.Transparency = 0
		wait(.3)
		FakeCup.DrinkGroup.Drink6.Transparency = 1
		FakeCup.DrinkGroup.Drink7.Transparency = 0
		wait(.3)
		FakeCup.DrinkGroup.Drink7.Transparency = 1
		FakeCup.DrinkGroup.Drink8.Transparency = 0
		wait(.3)
		FakeCup.DrinkGroup.Drink8.Transparency = 1
		FakeCup.Cup.Transparency = 1
		FakeCup.LidGroup.Lid.Transparency = 1
		FakeCup.LidGroup.NeonBig.Transparency = 1
		FakeCup.LidGroup.NeonSmall.Transparency = 1
		FakeCup.DrinkFall.Transparency = 1
		FakeCup.IceGroup.Ice1.Transparency = 1
		FakeCup.IceGroup.Ice2.Transparency = 1
		FakeCup.IceGroup.Ice3.Transparency = 1

		Cup.Parent = Character
		Cup.Drink.Transparency = 0
		Cup.Name = "e" --CHANGE NAME HERE
			
	else
		print("Error, no empty cup found.") 
	end
end)

Along with that, my tool, the drink, keeps falling apart and won’t fully stay in the player’s hand. How do I fix this?

I need help asap! DM me thru discord at $a#8668 or reply to this topic please!!
image
image

2 Likes

I’m pretty sure this is a problem with the proximity prompt itself. Some proximity prompts when put inside of a model will not show up due to the RequiresLineOfSight property. Set that property to false and it should be fixed.

3 Likes

To stop the drink From falling apart, use weld constraints

3 Likes

Also, mind sending me the error output?

2 Likes

Please do! It would help me a lot.

Which line is it erroring on though? (You can view it in the output when you play test it.)

1 Like

Apologies I read it wrong.
image
It doesn’t show anything for script errors…

Also this is fine for the tool right?
image
For the Part0 I set it to the Handle and for the Part1 I set it to the parent of the WeldContraint.

Yes, that’s how you do it. There are also plugins to auto-weld it for you, too.

1 Like

Perfect!! The tool is all in one piece! But the script is still not working…

Which part is it not working on?

1 Like


I checked and I’m still confused. It says line2 but there aren’t any script errors?

For line 2, the code should be:

local TouchPart = DrinkMachine.Parent.TouchPart
1 Like

Also, can u send the ice giver script?

I haven’t continued working on this one yet, I decided to finish the drink one first but i don’t even know what to do anymore. I basically want the player to be able to fill the drink after they get the cup with either ice first or just the drink using proximity prompt.

local Ice1View = game.Players.LocalPlayer.Backpack.EmptyCup.IceGroup.Ice1.Transparency
local Ice2View = game.Players.LocalPlayer.Backpack.EmptyCup.IceGroup.Ice2.Transparency
local Ice3View = game.Players.LocalPlayer.Backpack.EmptyCup.IceGroup.Ice3.Transparency
local ClickDetector = script.Parent.ClickDetector

local IceGiver = script.Parent
local TouchPart = IceGiver.TouchPart


ClickDetector.MouseClick:Connect(function(PlayerWhoClicked)
	TouchPart.Touched:Connect(function(PartThatTouched)
	local Cup = PartThatTouched.Parent
	print("Clicked ice!")
	Ice1View = 1
	wait(0.2)
	Ice2View = 1
	wait(0.2)
	Ice3View = 1
	wait(0.1)
	Cup.Name = "Empty Cup w/ Ice"
end

By the way, do you use discord by any chance? It would be a lot more easier to communicate. :slight_smile:

local Player = game:GetService("Players")
local LP = Player.LocalPlayer

local ClickDetector = script.Parent.ClickDetector
local IceGiver = script.Parent.TouchPart

IceGiver.Touched:Connect(function(Touching)
local FinalTouch = Touching.Parent

for i, v in ipairs(FinalTouch:WaitForChild(IceGroup):GetChildren()
if v:IsA("BasePart") or v:IsA("MeshPart") then
v.Transparency = 0
end
end
FinalTouch.Name = "Empty Cup w/ Ice"
end)
1 Like