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

I Cant Move a tool To starter pack when you click a button?

hello I cant move A tool into starterpack when you click it. I am going in pretty Blinefolded On this one. The only idea that i have is this.



local model = game.workspace.Joe2 local plr = game.Players.LocalPlayer local E = game.Workspace.THing

game.Workspace.Radio.ClickDetector.MouseClick:Connect(function() E.Parent = StarterPack <------------------------ This is The Code game.Workspace.Radio:Destroy() for _,part in pairs(model:GetChildren()) do if part : IsA("BasePart") then part.Anchored = false wait(10) part.Anchored = true

	end
	game.StarterGui.QuestGui.Reward.Visible = true
end

end)



Anybody have any idea on how i can fix this?

2 answers

First of all: Use a server script to replicate tools to the player. Assuming you’re using a local script it won’t work. You can’t use local player in a server script btw

Secondly: You can put your tool into the replicated storage, and use the Clone() function to clone it to the players backpack.

Example code:

game.Players.PlayerAdded:Connect(function(player)
script.Parent.ClickDetector:MouseClick:Connect(function()
local Clone = game.ReplicatedStorage.YourToolName:Clone()
Clone.Parent = player.Backpack
end)
end)
end

Did not test, let me know if the example code works if you do try it yourself

1 comment

0

It didint work i think i placed it wrong, You can take a look at my own answer

It Didint work I think I placed it wrong


game.Workspace.Radio.ClickDetector.MouseClick:Connect(function() game.Players.PlayerAdded:Connect(function(player) script.Parent.ClickDetector:MouseClick:Connect(function() local Clone = game.ReplicatedStorage.THing:Clone() Clone.Parent = player.Backpack

game.Workspace.Radio:Destroy()
for _,part in pairs(model:GetChildren()) do
	if part : IsA("BasePart") then
		part.Anchored = false
		wait(10)
		part.Anchored = true
		
	end
	game.StarterGui.QuestGui.Reward.Visible = true
end

end) end) end)


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