(Just making a script btw)
It seems as though your issue may arise from the fact that there are multiple parts named âFreddyâ within your workspace.
That might be true i just dont know how to make like âFreddy1â printed and named then another one generates âFreddy2â printed and named but heres a example
Add this script into ServerScriptService: (and change the variable sellBlock to your actual sell part thing)
local CollectionService = game:GetService("CollectionService")
local connections = {}
local function makeDrop(part)
local connection = part.Touched:Connect(function(hit)
if hit == sellBlock then --> sellBlock = whatever the sell thing is
part:Destroy()
-- Add money
end
end)
connections[part] = connection
end
for _, drop in pairs(CollectionService:GetTagged("Drop")) do
makeDrop(drop)
end
CollectionService:GetInstanceAddedSignal("Drop"):Connect(function(drop)
makeDrop(drop)
end)
CollectionService:GetInstanceRemovedSignal("Drop"):Connect(function(drop)
if connections[drop] then
connections[drop]:Disconnect()
end
end)
Then in the script where you are making the drops, once the drop has been made add this line:
game:GetService("CollectionService"):AddTag(drop --[[The part you just made]], "Drop")
Youâd need to go into the script that instances those parts to fix the naming issue. One possible way to do it would be is creating a variable, âxâ for example, and having that variable increase by 1 every time a part is created, then having the name of said instanced part set to âFreddyâ + x.
Thats hard to remember but ill try it
CollectionService is basically a service that lets you add any function to something - bad explanation but heres a tutorial if you wanted to learn a bit more about it.
Ok so i put it in there and why does it say --Add Money do i do something like
local tokens = game.Player:WaitForChild("leaderstats"):WaitForChild("Tokens")
???
Ok ill try the tutorial out tomorrow because i cant watch youtube until like Fridays and Saturdays
Itâs just there to show you thatâs where you would normally give money to the player, I donât know how youâre doing the money though so I just put â Add money
I have no idea ill take pic of explorer and scripts cause it aint working
Ok thank you for your time i think i should just make a folder everytime one spawns and delete that folder if you have any ideas i would love to hear them
What is the parent of that âfreddyâ?
I donât see it on the workspaceâŚ
Instead of putting the :AddTag thing in that script, put it just afterwards âFreddyâ has been made.
Ok im maaking freddy from a instance.new thing
do you mind showing the dropperâs script too?
Yea sorry i am working on a new game at this moment lemme open im just messing around with scripts
ok but plz copy and paste it here instead of posting a screen shot
Here it is
local drops = 0
while true do
task.wait(3)
drops+=1
local freddy = Instance.new("Part")
local droparea = script.Parent
freddy.Name = "Freddy"
freddy.Size = Vector3.new(1, 1, 1)
freddy.Position = droparea.Position -- the Vector3 position of "droparea"
freddy.Parent = workspace
end