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!
Why does the tool script won’t work when the tool is parented to the workspace? but worked when the tool parented to StarterPack. -
What is the issue? Include screenshots / videos if possible!
Error. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I TriedWaitForChild()
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local tool = script.Parent
local scoop = tool.Scoop
local backpack = tool.Parent
local player = backpack.Parent
local playerStats = player:WaitForChild("leaderstats")
local playerItems = playerStats:WaitForChild("Items")
local playerSpaces = playerStats:WaitForChild("Spaces")
local function onTouch(partTouched)
local canHarvest = partTouched.Parent:FindFirstChild("CanHarvest")
if canHarvest then
if canHarvest.Value == true and playerItems.Value < playerSpaces.Value then
playerItems.Value = playerItems.Value + 1
canHarvest.Value = false
partTouched.Transparency = 1
partTouched.CanCollide = false
wait(5)
canHarvest.Value = true
partTouched.Transparency = 0
partTouched.CanCollide = true
end
end
end
scoop.Touched:Connect(onTouch)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.