Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My Tool doesn't work when I place it into StarterPack, how can I fix it?

So basically, I have a cleaning script (I followed a YT tutorial). The script will only be for a certain group rank and that script will be included later. So, to do this I can't have players pick up the Tool from the ground in Workspace, but work when it's given to them from Server Storage into their Backpack. When I do this, however, it fails to work.

If it helps, I followed RoScripter YouTube video.

Mop Script:

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local UserInputService = game:GetService("UserInputService")

local MopAnimation = script.Parent.MopAnimation

local Equipped = false
local Mopping = false

local function isTargetASpill(Spill)
	if Spill.Parent == game.Workspace.SpillLocations then
		return true
	end
end


script.Parent.Equipped:Connect(function()
	Equipped = true
end)

script.Parent.Unequipped:Connect(function()
	Equipped = false
end)

UserInputService.InputBegan:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.Keyboard then
		if Input.KeyCode == Enum.KeyCode.E and Equipped == true and Mouse.Target and isTargetASpill(Mouse.Target) and Mopping == false then
			print("Pressed E while the tool was equipped")
			local Target = Mouse.Target
			Target.MopSpill:FireServer()
			
			local MopAnimationTrack = Player.Character.Humanoid:LoadAnimation(MopAnimation)
			MopAnimationTrack.Looped = true
			MopAnimationTrack:Play()
			
			Mopping = true
			wait(5)
			MopAnimationTrack:Stop()
			Mopping = false
			
			print(Target.Name)
		end
	end
end)

Spill Manager

local TweenService = game:GetService("TweenService")

local SpillLocationsFolder = game.Workspace.SpillLocations
local SpillLocations = SpillLocationsFolder:GetChildren()

for i = 1, #SpillLocations do
	local Spill = SpillLocations[i]
	local MopSpillEvent = Spill.MopSpill
	
	MopSpillEvent.OnServerEvent:Connect(function(Player)
		print("Cleaning Spill")
		local Tween = TweenService:Create(Spill, TweenInfo.new(5), {Size = Vector3.new(0, 0, 0)})
		Tween:Play()
		wait(5)
		Spill.Transparency = 1
		Player.leaderstats.Points.Value = Player.leaderstats.Points.Value + 1
	end)
end

while true do
	local RandomSpill = SpillLocations[math.random(1, #SpillLocations)]
	RandomSpill.Transparency = 0
	RandomSpill.BrickColor = BrickColor.Random()
	RandomSpill.Size = Vector3.new(0.1, 4.4, 4.65)
	wait(60)
end

2 answers

Make Sure You have a Tool object inStarter Player and the parent is named Handle. If its not gripping correctly then get the plugin here

You need a plugin to grip the tool and also name the part you hold 'Handle' otherwise it won't work! Let me know if you need further support!

This discussion is preserved as it was. New answers, comments, and votes are closed.