I have a tool with a local script inside it that works perfectly fine in the StarterPack. However, I don’t want it in the starter pack and want to bring it to the player after an event is called. When the event is called I fire a remote event and the server script makes a copy of the tool and puts it into the players backpack. This works, however the local script inside the tool doesn’t work like it would if it started in the StarterPack.
Local Script:
local Player = game.Players.LocalPlayer
script.Parent.Activated:Connect(function()
script.RemoteEvent:FireServer()
end)
Server Script:
script.Parent.RemoteEvent.OnServerEvent:Connect(function(Player)
local SukeTool = game.ReplicatedStorage.Suke:Clone()
SukeTool.Parent = Player.Backpack
script.Parent.Parent:Destroy()
end)
A tool in the StarterPack is cloned into the backpack anyway so why doesn’t cloning it from the ReplicatedStorage work?
script in tool that is meant to be transported to backpack:
print("ScriptRun")
local Tool = script.Parent
local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = Player.CharacterAdded:Wait()
local debounce = false
local Tween = game:GetService("TweenService")
local Info = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
local Goal = {Transparency = 1}
UIS.InputBegan:Connect(function(input, IsTyping)
print("Input")
if Character:FindFirstChild("Suke") and Character.Suke:IsA("Tool") then
if IsTyping then return end
if input.KeyCode == Enum.KeyCode.E then
print("E")
if not Character:GetAttribute("Active")then
if debounce == false then
debounce = true
Character:SetAttribute("Active",true)
print("StartInvis")
for i,v in pairs(Character:GetChildren())do
if v:IsA("BasePart") then
local TweenPlay = Tween:Create(v,Info,Goal)
TweenPlay:Play()
if v.Name == "Head" then
local TweenPlay = Tween:Create(v.face,Info,Goal)
TweenPlay:Play()
end
elseif v:IsA("Accessory") then
for _,AccessoryPart in pairs(v:GetChildren()) do
local TweenPlay = Tween:Create(AccessoryPart,Info,Goal)
TweenPlay:Play()
end
end
end
wait(2)
debounce = false
Character:SetAttribute("Active",false)
end
end
end
end
end)
There is a print at the beginning that doesn’t fire at all.
Edit: the print does fire now so the script is running. The user input is still broken though.
I’d just like to add that you should probably move your tools to server storage as exploiters can access anything client sided, such as replicated storage.
My newfound solution is to put the tool into the players starter gear then kill the player. It would be nice to not have to kill the player but I believe this is the solution I am looking for. Putting the tool in the players backpack also makes it disappear when the player dies which wasn’t what I was looking for.