I have a simple gun, it clones a part that has a script that just detects hits by making a ray from it’s current position and it’s last position that is in replicated storage and then uses a tween to move it to the target position. For some reason, the bullet is only seen server-side. It can still detect hits and those hits are replicated, just not the bullet itself. I tried disabling StreamingEnabled since that seemed to be a culprit of situations similar to this, but to no avail. I also checked the LocalScripts in my game and couldn’t find anything that would delete it.
main script code for gun:
local ts = game:GetService("TweenService")
local firesound = script.Parent.Handle.Fire
local bulletspeed = script.Parent.Handle.bulletspeed.Value
local range = script.Parent.Handle.maxrange.Value
script.Parent.Activated:Connect(function()
firesound:Play()
script.Parent.muzzle.flash.Enabled = true
delay(0.1, function()
script.Parent.muzzle.flash.Enabled = false
end)
local clone = game.ReplicatedStorage.bullet:Clone()
clone.CFrame = script.Parent.muzzle.CFrame
clone.LimbDmg.Value = script.Parent.Handle.LimbDmg.Value
clone.TorsoDmg.Value = script.Parent.Handle.TorsoDmg.Value
clone.HeadDmg.Value = script.Parent.Handle.HeadDmg.Value
clone.Parent = script.Parent.Parent
local r = math.random(-50,50)
local tweentarg = script.Parent.muzzle.Position + ((script.Parent.muzzle.CFrame.LookVector + Vector3.new(r,r,r)) * range)
print(tweentarg)
local goal = {}
goal.Position = tweentarg
local tween = ts:Create(clone,TweenInfo.new(script.Parent.Handle.bulletspeed.Value),goal)
tween:Play()
clone.Script.Enabled = true
tween.Completed:Connect(function()
clone:Destroy()
end)
end)
I can show the localscripts in it as well if needed, but I am pretty confident they aren’t the reason.
Also don’t mind the ‘r’ value and what it’s being used for, I was testing bullet spread.
Any help is appreciated!