So as you can tell from the title, I used .AncestryChanged and .CharacterAdded as an attempt to fix my problem, but it didn't work.The scripts inside the tool break when the tool is cloned into the player's backpack.
The gun is cloned from the ServerStorage by a ServerScript in ServerScriptService.
No errors, either.
Sorry if the the script is long.
local mouse = game.Players.LocalPlayer:GetMouse()local spread = .75
local ts = game:GetService("TweenService")
local ti = TweenInfo.new(0.5,Enum.EasingStyle.Elastic,Enum.EasingDirection.Out,0,true,0)
local ti2 = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
local cam = workspace.CurrentCamera
local canFire = true
local fireRate = 2
local uis = game:GetService("UserInputService")
local reloading = false
local player = game.Players.LocalPlayer
local char = game.Players.LocalPlayer.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local lockMouse = false
local hold = hum:LoadAnimation(script.Parent.hold)
local canTouch = true
script.Parent.Activated:Connect(function()
if reloading == false then
if canFire == true and reloading == false then
canFire = false
local CameraShaker = require(game.ReplicatedStorage.CameraShaker)
local camera = workspace.CurrentCamera
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCf)
camera.CFrame = camera.CFrame * shakeCf
end)
camShake:Start()
camShake:Shake(CameraShaker.Presets.Explosion)
script.Parent.Handle.laser:Play()
script.Parent.Bullet:FireServer(mouse.Hit.p,ti2,ts)
wait(fireRate)
canTouch = true
canFire = true
end
end
end)
script.Parent.Equipped:Connect(function(mouse)
hold:Play()
uis.MouseIconEnabled = false
player.PlayerGui:WaitForChild("Aim").Enabled = true
end)
script.Parent.Unequipped:Connect(function()
hold:Stop()
uis.MouseIconEnabled = true
player.PlayerGui:WaitForChild("Aim").Enabled = false
end)
I have zero idea on why this is happening. Help please!

7 comments
What I think is, that the whole
AncestryChangedevent is not required as scripts won't run in ReplicatedStorage. When you copy it, the script will run and do everything.Im not sure what you are trying to do here? Can you explain what this script should do. I see no reason to include the AncestryChanged event..
You should avoid putting tools in re storage if you are giving them out once the buy them. Just clone them from server storage as it is safer.
@kingdom5 okay
@kingdom5 nope doesn't work.
This should also be a local script and it will only run in some locations. see the wiki.
okay