I am currently working on my game, Roblox HD, I decided to make a Bloxy Cola giver (and I had make a cooling box for drinks as well for the Bloxy Colas), I made them, then I scripted them, but when I tested the giver, it doen't give me a single Bloxy Cola at all.
Code: (LocalScript, relies on a part named InteractablePart and a ClickDetector inside the part, also relies a folder named SharedObjects, the Bloxy Cola tool is inside that folder)
repeat wait() until game.ReplicatedStorage:WaitForChild("SharedObjects")
local plr = game.Players.LocalPlayer
local ColaTool = game.ReplicatedStorage.SharedObjects.BloxyCola
local ClickDetector = script.Parent.InteractablePart.ClickDetector
ClickDetector.MouseClick:Connect(function()
local cloned = ColaTool:Clone()
cloned.Parent = plr.Backpack
end)
At first, I thought that the repeat wait that I use was the cause (I use the repeat wait so that it will wait until the SharedObjects folder to load, the Bloxy Cola is inside the folder), but when I removed the line, it still doesn't work.
No errors show up in the console.
Game link: https://web.roblox.com/games/4715818343/Roblox-HD

2 comments
repeat wait() until game.ReplicatedStorage:WaitForChild("SharedObjects") this is kinda residual.
better add a wait at the top rather than repeat, until