You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I need that tools can only be grabbed once by the same player as long as the item is already in its backpack -
What is the issue? Include screenshots / videos if possible!
When the player touches the tool, he grabs it. After the tool respawns, he can touch it again and the tool duplicates. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Ive been checking videos, tutorials and posts. Also some scripts from toolbox and editing all to fit but cant seem to make em work, im new to scripting.
Im having alot of trouble with this for some reason, i will keep looking but if anyone could help with this it would be greatly appreciated as nothing seems to work so far. Also, im not very sure where to put the script that would fix it.
Here is my respawning tool script in case it helps, i found it in the toolbox (its a part in the workspace that seems to clone the tool i put above it)
-- See if I have a tool
local spawner = script.Parent
local tool = nil
local region = Region3.new(Vector3.new(spawner.Position.X - spawner.Size.X/2, spawner.Position.Y + spawner.Size.Y/2, spawner.Position.Z - spawner.Size.Z/2),
Vector3.new(spawner.Position.X + spawner.Size.X/2, spawner.Position.Y + 4, spawner.Position.Z + spawner.Size.Z/2))
local parts = game.Workspace:FindPartsInRegion3(region)
for _, part in pairs(parts) do
if part and part.Parent and part.Parent:IsA("Tool") then
tool = part.Parent
break
end
end
local configTable = spawner.Configurations
local configs = {}
local function loadConfig(configName, defaultValue)
if configTable:FindFirstChild(configName) then
configs[configName] = configTable:FindFirstChild(configName).Value
else
configs[configName] = defaultValue
end
end
loadConfig("SpawnCooldown", 1)
if tool then
tool.Parent = game.ServerStorage
while true do
-- put tool on pad
local toolCopy = tool:Clone()
local handle = toolCopy:FindFirstChild("Handle")
toolCopy.Parent = game.Workspace
local toolOnPad = true
local parentConnection
parentConnection = toolCopy.AncestryChanged:connect(function()
if handle then handle.Anchored = false end
toolOnPad = false
parentConnection:disconnect()
end)
if handle then
handle.CFrame = (spawner.CFrame + Vector3.new(0,handle.Size.Z/2 + 1,0)) * CFrame.Angles(-math.pi/2,0,0)
handle.Anchored = true
end
-- wait for tool to be removed
while toolOnPad do
if handle then
handle.CFrame = handle.CFrame * CFrame.Angles(0,0,math.pi/60)
end
wait()
end
-- wait for cooldown
wait(configs["SpawnCooldown"])
end
end
Thanks beforehand