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.
1 |
01 | <pre class = "brush: lua" > local model = game.workspace.Joe 2 |
02 | local plr = game.Players.LocalPlayer |
03 | local E = game.Workspace.THing |
04 |
05 | game.Workspace.Radio.ClickDetector.MouseClick:Connect( function () |
06 | E.Parent = StarterPack < ------------------------ This is The Code |
07 | game.Workspace.Radio:Destroy() |
08 | for _,part in pairs (model:GetChildren()) do |
09 | if part : IsA( "BasePart" ) then |
10 | part.Anchored = false |
11 | wait( 10 ) |
12 | part.Anchored = true |
13 |
14 | end |
15 | game.StarterGui.QuestGui.Reward.Visible = true |
16 | end |
17 |
18 | end ) |
19 | </pre> |
1 |
Anybody have any idea on how i can fix this?
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:
1 | game.Players.PlayerAdded:Connect( function (player) |
2 | script.Parent.ClickDetector:MouseClick:Connect( function () |
3 | local Clone = game.ReplicatedStorage.YourToolName:Clone() |
4 | Clone.Parent = player.Backpack |
5 | end ) |
6 | end ) |
7 | end |
Did not test, let me know if the example code works if you do try it yourself
It Didint work I think I placed it wrong
1 |
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
01 | game.Workspace.Radio:Destroy() |
02 | for _,part in pairs (model:GetChildren()) do |
03 | if part : IsA( "BasePart" ) then |
04 | part.Anchored = false |
05 | wait( 10 ) |
06 | part.Anchored = true |
07 |
08 | end |
09 | game.StarterGui.QuestGui.Reward.Visible = true |
10 | end |
end) end) end)
1 |