Tools Only Work In Workspace And Not In StarterPack

hello it is me again!

i am making this game where you plant seeds in the ground and eventually grows something.
there are 3 tools: a bucket(water your plants),a plow(makes dirt patches),seed(plants seeds in dirt).
now 1 works when i put it in starterpack!
they all 3 work when i just leave them in workspace.
but the plow and the seed use remoteevents that are stored in the tool to send to the server, to change whatever in this case make dirt , spawn seeds for flowers and change values…
when i put them all three in starterpack, it says “RemoteEvent is not a valid member of [insert tool name here]”. even if i leave them in workspace and then clone them it does the same.
this is a huge problem because now i have to place a certain amount of tools in workspace and if more players join than there are then some can’t even play the game… :frowning:

script for seed but it is the same in the plowscript:

localscript:

local Event = script.Parent.RemoteEvent

local Mouse = game.Players.LocalPlayer:GetMouse()
local Cooldown = 5
local CanUse = true

script.Parent.Activated:Connect(function()
	if CanUse then
		if Mouse.Target == workspace.Baseplate then
		CanUse = false
		--Sound:Play()
		Event:FireServer(Mouse.Hit.Position)
		task.wait(Cooldown)
			CanUse = true
		end
	end

serverscript:

local Tool = script.Parent
local Handle = Tool.Handle

local Connection = Tool.Connection
local BadgeService = game:GetService("BadgeService") 
local Module = require(game.ReplicatedStorage.PlantModule)


local Plants = Module.Names

local PlantChance = Module.PlantChance

local Ids = Module.Ids


local function SearchTable(index,Table)
	for i,v in pairs(Table) do
		if i == index then
			return v
		end
	end
end

Connection.OnServerEvent:Connect(function(plr,Part)
	print(Part)
	if Part then
		if Part:IsA("Part") and Part.Name == "Dirt" then
			if Part:GetAttribute("Flower") == "Nothing" then
				local Chance = math.random(1,4)
				for i,v in pairs(Plants) do
					local Result = SearchTable(i,PlantChance)
					if Result then
						if Result == Chance then
							Part:SetAttribute("Flower",v)
							local BadgeID = SearchTable(i,Ids)
							Part:SetAttribute("Playerid",plr.UserId)
							Part:SetAttribute("Badgeid",BadgeID)
						end
					end
				end
			end
		end
	end
end)

i don’t know why you would need the whole script since the rest except for the 3 variables at the top are irrelevant but i wrote it anyway.

here is a screenshot of the error:
ErrorScreenshot
and here are the tool’s children:
ToolInsidesScreenshot

hopefully this is all you need!

thanks in advance!

edit: changed title from “tools only work in server” to “tools only work in workspace and not in starterpack”

edit: added this and the other edit.

Use :WaitForChild,

local Connection = Tool:WaitForChild("Connection")

1 Like

thanks you solved it,
can i ask a question?
why does waitforchild work?

The script ran before the Connection remote was parented to the Tool and the script just couldnt find it inside the tool

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.