Could you elaborate on that issue?
Does the code provide any errors in the output?
New Script:
-- EToPickUp Script
local ToolNames = {"Battery"} -- Change Item to your item name and move it to ServerStorage
local Storage = game.ServerStorage.RareItems
local Part = script.Parent
local ProximityPrompt = Part:WaitForChild("ProximityPrompt")
ProximityPrompt.Triggered:connect(function(Player)
if Player and Player.Character then
local Backpack = Player:WaitForChild("Backpack")
for i = 1, #ToolNames do
local Tool = Storage:FindFirstChild(ToolNames[i])
if Tool then
if Backpack:FindFirstChild(Tool.Name) == nil then
game:GetService("ServerStorage").BatteryPickup:Fire()
Tool:clone().Parent = Backpack
Tool:Destroy()
end
end
end
end
end)
Original Script:
-- EToPickUp Script
local ToolNames = {"GroupCola"} -- Change Item to your item name and move it to ServerStorage
local Storage = game.ServerStorage.RareItems
local Part = script.Parent
local ProximityPrompt = Part:WaitForChild("ProximityPrompt")
ProximityPrompt.Triggered:connect(function(Player)
if Player and Player.Character then
local Backpack = Player:WaitForChild("Backpack")
for i = 1, #ToolNames do
local Tool = Storage:FindFirstChild(ToolNames[i])
if Tool then
if Backpack:FindFirstChild(Tool.Name) == nil then
Tool:clone().Parent = Backpack
end
end
end
end
end)
You’re destroying the tool in ServerStorage right after putting it in the backpack.
Instead of Tool:Destroy()
do Part:Destroy()
.
there is still no difference between the both.
Make sure the script is actually finding the item then. From what you wrote it’ll check if Tool isn’t nil
, so make sure it isn’t.
After the if statement, add a print statement, like so:
if Tool then
print("Tool found.")
else
print("Tool is nil.")
end
local ToolNames = {"Battery"} -- Change Item to your item name and move it to ServerStorage
local Storage = game.ServerStorage.RareItems
local Part = script.Parent
local ProximityPrompt = Part:WaitForChild("ProximityPrompt")
ProximityPrompt.Triggered:connect(function(Player)
if Player and Player.Character then
local Backpack = Player:WaitForChild("Backpack")
for i = 1, #ToolNames do
local Tool = Storage:FindFirstChild(ToolNames[i])
if Tool then
if Backpack:FindFirstChild(Tool.Name) == nil then
Tool:clone().Parent = Backpack
Part:Destroy()
end
end
end
end
end)
Can I use this Script because it actually gives me the item.
Yes, that would be the script to use then.
I tried taking the Battery and it didn’t move to a different position.
As I mentioned before would it be easier if I would to just send it all in a kit?
I feel like that might be an issue with how you run it’s position. But if the .CFrame
and the Vector you’re adding are on a separate lines, put them on the same line, so it looks like this:
clone.CFrame = toolSpawns[math.random(1,#toolSpawns)].CFrame + Vector3.new(2,1,0) -- Picks one random Spawns CFrame with Y offset of 1 stud.
My silly a$$ didn’t put the Battery Tool
in ServerStorage and I had to add this – game:GetService("ServerStorage").BatteryPickUp.BatteryRespawn:Fire()
That was the conclusion I was coming to as I worked on it.
lol sorry about that, it is currently 5am and I’ve been working non-stop for the last 2 weeks.
My next piece of advice now is to get some sleep.
than you very much for helping me.