there are a bunch of problems they are all named cookie now, you can only pick up some of the items and if you equip the tool it duplicates it in workspace.
- that is for you to change, ive put it in the script, the name of it must match the tool name. you can do that yourself to match your tools
- its to prevent picking up the same item twice, since theyre all cookies, u can only pick up 1 cookie
- theyre not duplicated, its js new one spawning in. you can change the interval urself
Why not just hire a scripter? This is devforum, for the poor. Go to talent hub if you’re paying. You’re making me sad.
fr bro
also a minor code update on the server script one
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local remoteEvent = Instance.new("RemoteEvent")
remoteEvent.Name = "ToolClaimEvent"
remoteEvent.Parent = ReplicatedStorage
local lootsFolder = ServerStorage:WaitForChild("Loots")
local function handleLootItems(lootModel: Model)
for _,part in lootModel:GetChildren() do
if not part:IsA("BasePart") then continue end
local detect = Instance.new("ClickDetector")
detect.Parent = part
detect.MaxActivationDistance = 32
detect.MouseClick:Connect(function(player: Player)
local tool = game:GetService("ServerStorage"):WaitForChild("Tools"):FindFirstChild(part.Name) -- Checks if theres a tool with the same name as the clicking part
if not tool then return end
local playerBackpack = player:WaitForChild("Backpack")
if not playerBackpack:FindFirstChild(tool.Name) and not player.Character:FindFirstChild(tool.Name) then
tool:Clone().Parent = playerBackpack
remoteEvent:FireClient(player,part)
end
end)
end
end
local function spawnLoots(lootName: string,spawnCFrame)
local existing = lootsFolder:FindFirstChild(lootName)
if not existing then return end
local cloned = existing:Clone()
pcall(function()
if cloned.PrimaryPart and spawnCFrame then
cloned.PrimaryPart.CFrame = spawnCFrame
end
end)
cloned.Parent = workspace:WaitForChild("Loots")
handleLootItems(cloned)
end
local allLoots = {"LootTools1","LootTools2","LootTools3","LootTools4"}
spawnLoots(allLoots[math.random(1,#allLoots)]) -- remove?
while task.wait(15) do
if math.random()>0.75 then
spawnLoots(allLoots[math.random(1,#allLoots)])
end
end
mark me as solution im farming solutions rn dwg
if it works ill do that and pay u i got to test everything first.
almost working just one more problem if you have 2 apples and pick one up u cant pick the other up same for the 2 cookies. i want it to stay under the same name and not make a new apple tool.
if u already have 1 tool, you cant pick the other tool.
send me a video of the bug
it says the file is too big… its literally a 7 second clip.
now its broken even more, 2 of the models spawn in one game and now it doest delete anything.
its only giving the tools now.
nvm that one dosnt work u made a remote event so it was awaiting event from the wrong event try this
ToolPickUp Test.rbxl (61.6 KB)
k just got to check one more thing does the model spawn multiple times or no?
idk how u want it to do it dawg, here it does spawn multiple.
i just want one per game. i was just wondering if it spawned multiple tho. how should i go about changing it so only one spawns per game?
it alr does dat, spawns once at the start n thas it
u can check the server script code, spawn it urself at anytime with
spawnLoots(name)
gonna do one last test then im done.