I try make Box of Soda RNG SODA but Idk how to script , i look alot media but don’t have answer i wanted, all i try is look almost same but my script not work
Script:
```local Soda = script.Parent
local prompt = Soda:WaitForChild("ClickDetector")
local ServerStorage = game:GetService("ServerStorage")
local ItemsFolder = ServerStorage:WaitForChild("Soda1in2")
local minTime = 1
local maxTime = 5
local function Give1in2Item(player)
local items = ItemsFolder:GetChildren()
if #items > 1 then
local randomItem = items[math.random(1, #items)]:Clone()
randomItem.Parent = player.Backpack -- Give the item to the player's backpack
end
end
local function handlePrompt()
prompt.Enabled = false
wait(math.random(minTime, maxTime))
prompt.Enabled = true
end
prompt.Triggered:Connect(function(player)
Give1in2Item(player)
handlePrompt()
end)
script.Parent.ClickDetector.MouseClick:Connect(Give1in2Item)