Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i make a die when you drink too much bloxy cola script?

i've been wondering though how to make one i can't think of one because i'm kind of new to scripting the die when you drink too much bloxy cola came to me when i played delicious consumables simulator

1 answer

This is a server script and you'll need to put it into the tool. Btw this is an overcomplicated version and the lethalAmount variable is how many times the player has to drink before he dies. You can edit it to whatever value you would like it to be.

	local drinkCounter
local lethalAmount = 5

script.Parent.Equipped:Connect(function(player)
	if script.Parent.Parent:IsA("Model") then
		local character = workspace[script.Parent.Parent.Name]

		local playerCounter = Instance.new("IntValue", character)
		playerCounter.Name = script.Parent.Name
		drinkCounter = playerCounter
	else
		if script.Parent.Parent:IsA("Backpack") then
			local character = workspace[script.Parent.Parent.Parent.Name]

			local playerCounter = Instance.new("IntValue", character)
			playerCounter.Name = script.Parent.Name
			drinkCounter = playerCounter
		end
	end
end)

script.Parent.Activated:connect(function(player)
	drinkCounter.Value = drinkCounter.Value + 1
	
	if drinkCounter.Value == lethalAmount then
		if script.Parent.Parent:IsA("Model") then
			local character = workspace[script.Parent.Parent.Name]
			
			character.Humanoid.Health = 0
			drinkCounter.Value = 0
		else
			if script.Parent.Parent:IsA("Backpack") then
				local character = workspace[script.Parent.Parent.Parent.Name]

				character.Humanoid.Health = 0
				drinkCounter.Value = 0
			end
		end
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.