I’m having issues with my client script not picking up on a part named “Bullet” that was replicated and parented to workspace by a serverscript and then passed onto the client as a objValue.
I tried just passing the part as a value and not wrapped in a objvalue, well that failed, so then I tried passing it as a object value and that also failed, the client never seems to recognize the part exists no matter what.
Server Script
game.ReplicatedStorage.ShotFired.OnServerEvent:Connect(function(player, mousePosition, Hull, Barrel)
local bullet = game.ReplicatedStorage.Bullet:Clone()
bullet.Parent = workspace
bullet.CanCollide = false
bullet.CFrame = Barrel.Attachment.WorldCFrame
task.wait()
bullet:SetNetworkOwner(player)
game.Debris:AddItem(bullet, 10)
local objvalue = Instance.new("ObjectValue")
objvalue.Value = bullet
game.ReplicatedStorage.ShotFired:FireClient(player, objvalue)
end)
Local Script
game.ReplicatedStorage.ShotFired.OnClientEvent:Connect(function(objValue)
local bullet = objValue.Value
bullet:ApplyImpulse(bullet.CFrame.LookVector * bullet.AssemblyMass * 500)
end)