You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve?
Long story short, creating an FPS game and have a custom reloading animation with moving parts. Whenever i parent the tool to StarterPack, it works perfectly fine. However whenever I have the same exact weapon in replicated storage, it flips out and doesnt work when i use a script to put it in the players backpack. You can see this demonstrated below.
- What is the issue? Include screenshots / videos if possible!
- What solutions have you tried so far?
I tried looking up solutions to no avail. I have tried changing when the local script activates, giving network ownership, and so much other stuff. I am not one to usually make forum posts but after going through 3 discords and 8 hours of troubleshooting I’m kind of out of options.
I have noticed that the frame i pull out the buggy gun it works but then the part teleports facing in my direction like it should be but it teleports below my character around 100 studs. Below is the script that controls the reloading part
repeat wait() until script.Parent.Parent:FindFirstChild("GunScript")
local Reloader = script.Parent.Parent.Parts.Reloader
local FakeRelaoder = Reloader:Clone()
local frc = FakeRelaoder:GetChildren()
for m=1, #frc do
if frc[m]:IsA("Weld") or frc[m]:IsA("WeldConstraint") then
frc[m]:Destroy() -- deletes all of the welds from the original reloader part
end
end
FakeRelaoder.Parent = script.Parent.Parent.Parts -- parents the fake reloader to the parts folder of the gun
FakeRelaoder.Anchored = true -- makes sure that the part doesnt move / get deleted
FakeRelaoder.Name = "FakeReloader"
local rs = game:GetService("RunService")
local parts = script.Parent.Parent.Parts:GetChildren()
FakeRelaoder.CFrame = Reloader.CFrame -- sets the cframe to this so it properly welds the iron sights to the fake part
for v=1, #parts do
if parts[v].Name:match("IS") then
local wc = Instance.new("WeldConstraint")
wc.Parent = FakeRelaoder
wc.Part0 = FakeRelaoder
wc.Part1 = parts[v] -- welds all the iron sight parts to the gun so they move with the reload animation / shooting animation
parts[v].Anchored = false -- unanchores them for obvious reasons
end
end
rs.RenderStepped:Connect(function()
if Reloader.Transparency ~= 1 then Reloader.Transparency = 1 end
FakeRelaoder.CFrame = Reloader.CFrame * CFrame.new(0, script.Parent.LoaderOffset.Value, 0) -- the main juice. this is what teleports the fake reloader part every frame
if FakeRelaoder.Transparency == 1 then FakeRelaoder.Transparency = 0 end
end)
This system has a seperate gun script that works fine with guns without the moving reloading parts so i think it isnt the culprit. And a module script unique for each gun that controlls the tweening of the loaderoffset value as seen in my script
But yeah i think thats all you need to know. If you do need more info however feel free to ask for it and i will provide.