by the way this is my first post so please bear with me here.
What do i want to achieve?
i have this viewmodel system i’ve been working on im pretty much done with it in terms of client sided stuff, but not really with server sided things i’m currently trying to make a system where if a player equips a tool it will replicate it’s viewmodel to the player’s character
i still want the full movements but what i am looking for is something that does replicate the viewmodel to the player’s character but constantly changes the player’s arm’s to replicate the movements of the arms in the viewmodel
Viewmodel in question:
(by the way does it look cool? im only a beginner at blender animations)
The Issue?
I couldn’t really figure out how to replicate the viewmodel to the server efficiently as welding it seems to mess with the physics of the player and using something like a loop or RunServ.Stepped makes the viewmodel delayed from the player’s position, i’m not really looking for that
What Have i tried so far?
I Tried making a system that would only replicate the viewmodel to the other clients and not the server by using FireAllClients() and having the player’s arm become basically not there then i would handle the event stuff in a localscript located in StarterPlayerScripts which worked great but it had a small issue, when a player shoots a bullet which would be on the server it wouldn’t detect the arms on the viewmodel…
ill throw an example as at this time i do not have access to the code i wrote
-- Server Sided Reciever
local ExampleEvent = game.ReplicatedStorage.Event
ExampleEvent.OnServerEvent:Connect(function(plr, ViewmodelName)
ExampleEvent:FireAllClients(plr, ViewmodelName)
-- imagine down here some lines that would basically disable the arms of the player
end)
-- LocalSript VM Handler
local ExampleEvent = game.ReplicatedStorage.Event
ExampleEvent.OnClientEvent:Connect(function(Target, ViewmodelName)
local Model = game.ReplicatedStorage.Viewmodels:FindFirstChild(ViewmodelName)
if not Model then return end
local Viewmodel = Model:Clone()
Viewmodel.Parent = Target.Character
local Loop
Loop = game:GetService("RunService").RenderStepped:Connect(function()
Viewmodel.PrimaryPart:PivotTo(Target.Character.Head)
end)
end)
-- Bullet Module
function Bullet(StartCF)
local Bullet = Instance.new("Part")
Bullet.CFrame = StartCF
Bullet.Name = "Bullet"
Bullet.Parent = workspace.Debris.Bullets
Bullet.Size = Vector3.new(0.25, 0.25, 1)
Bullet.Anchored = false
Bullet.CanCollide = false
Bullet.CanTouch = true
Bullet.Color = Color3.fromRGB(255, 255, 127)
Bullet.Material = Enum.Material.Neon
Bullet.Massless = false
game:GetService("Debris"):AddItem(Bullet, 5)
local attach = Instance.new("Attachment", Bullet)
local VectorFor = Instance.new("VectorForce", Bullet)
VectorFor.Attachment0 = attach
VectorFor.Force = Vector3.new(0, -Bullet:GetMass() / 5, 0)
VectorFor.RelativeTo = Enum.ActuatorRelativeTo.World
Bullet.AssemblyLinearVelocity = StartCF.LookVector * 500
local result = workspace:Raycast() -- Raycast Started from StartPos
if result then
Bullet:Destroy()
local hum = result.Instance.Parent:FindFirstChild("Humanoid")
if hum then
hum:TakeDamage(5)
end
end
end
and thats pretty much it