Hello everyone! So I’ve been trying to make a tool work, for some reason, when I put it inside StarterPack, It works, but if I put the tool in ServerStorage and then use a script to clone it into the players backpack, the tool appears, but doesnt function. Here are some screenshots.
Parented already in StarterPack - https://gyazo.com/9a92297b96a5dfc6bd69842cc29b2452
Parented using script -
https://gyazo.com/c02a4711369aa6952ee26448d68732d5
Code of the tool I’m using -
local tool = script.Parent
local player = game.Players.LocalPlayer
local rp = game:GetService("ReplicatedStorage")
local hum = player.CharacterAdded:Wait():WaitForChild("Humanoid")
local TweenService = game:GetService("TweenService")
local mouse = player:GetMouse()
local BarrageEvent = rp:WaitForChild("VampiricBarrage")
local holdingdown = false
local holdingdowncooldown = 0.7
--[[
tool.Activated:Connect(function()
BarrageEvent:FireServer(tool)
end)
]]
function checkTool(character,toolName)
for _, v in pairs(character:GetChildren()) do
if v:IsA("Tool") then
if v.Name == toolName then
return true
end
end
end
return false
end
mouse.Button1Down:Connect(function()
if checkTool(player.Character,tool.Name) then
holdingdown = true
repeat
BarrageEvent:FireServer(tool)
wait(holdingdowncooldown)
until not holdingdown
end
end)
mouse.Button1Up:Connect(function()
if checkTool(player.Character,tool.Name) then
holdingdown = false
end
end)
tool.Unequipped:Connect(function()
holdingdown = false
end)
Code of the script that clones the tool into the player’s backpack -
local rp = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local Shockwave = rp:WaitForChild("Shockwave")
local VampiricHealth = rp.Health
local VampiricBarrage = game:GetService("ServerStorage")["Vampiric Barrage"]
local shockwaveTween = TweenInfo.new(
1,
Enum.EasingStyle.Exponential,
Enum.EasingDirection.In,
0,
false,
0
)
local StartShockwave = {
Size = Vector3.new(20.919, 8.698, 25.416)
}
local EndShockwave = {
Size = Vector3.new(2.619, 1.089, 3.182);
}
local StoneMaskTransform = rp:WaitForChild("StoneMaskTransform")
StoneMaskTransform.OnServerEvent:Connect(function(player,tool)
local ClonedShockWave = Shockwave:Clone()
ClonedShockWave.Parent = workspace
ClonedShockWave.Position = player.Character.HumanoidRootPart.Position
TweenService:Create(ClonedShockWave,shockwaveTween,StartShockwave):Play()
wait(1)
TweenService:Create(ClonedShockWave,shockwaveTween,EndShockwave ):Play()
wait(1)
ClonedShockWave:Destroy()
-- we give him vampire
-- remove mask first
player.Backpack:WaitForChild("Stone Mask"):Destroy()
-- give him vampire abillities
player.Character.Humanoid.MaxHealth = 150
player.Character.Humanoid.Health = 150
player.Character.Humanoid.WalkSpeed = 18
-- give him vampiric face
player.Character.Head.face.Texture = "rbxassetid://2606174048"
-- give him vampiric healing
-- destroy old regen script
player.Character.Health:Destroy()
local ClonedVampiricHealth = VampiricHealth:Clone()
ClonedVampiricHealth.Parent = player.Character
ClonedVampiricHealth.Disabled = false
local ClonedBarrage = VampiricBarrage:Clone()
ClonedBarrage.Parent = player:WaitForChild("Backpack")
ClonedBarrage.Enabled = true
end)