I’m attempting to fire an event to all client but im assuming its not firing because nothing is being printed from the local handler.
– Module –
function module.equip(viewmodel, gun, hold)
local gunhand = gun.WeaponComponents.Handle
local hrpM6D = viewmodel:WaitForChild("HumanoidRootPart").Handle
gun.Parent = viewmodel
hrpM6D.Part1 = gunhand
local Hold = viewmodel.AnimationController:LoadAnimation(hold)
Hold:Play()
-- 3rd Person
local third = game.ReplicatedStorage.Events.Equip3rd
local player = game.Players.LocalPlayer.Name
third:FireServer(gun.Name)
third.OnClientEvent:Connect(function(clone)
for i, v in pairs(clone:GetDescendants()) do
if v:IsA("Part") or v:IsA("MeshPart") then
print("Transparency!!!")
v.Transparency = 1
end
end
end)
end
– Server –
third.OnServerEvent:Connect(function(plr, gun)
local player = plr.Name
local gun = gun
local repstor = game:GetService("ReplicatedStorage")
local clone = repstor.ThirdWeapons[gun][gun]:Clone()
local anim = repstor.ThirdWeapons[gun].Animations
clone.Parent = game.Workspace[player]
third:FireAllClients(clone)
end)
Are you running module.equip(...)
?
Yes, this is in a local script
function startupmelee()
hum.WalkSpeed = weaponmod.runspeed
game:GetService("UserInputService").MouseIconEnabled = false
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
viewmodel.Parent = game.Workspace.Camera
game:GetService("RunService").RenderStepped:Connect(function(dt)
meleemod.update(viewmodel, dt, recoilspring, bobblespring, swayspring, gun, isaim)
end)
meleemod.weldgun(gun)
meleemod.equip(viewmodel, gun, anims.Hold)
local IsPlayerHoldingMouse
local canFire = true
local del = weaponmod.delay
local DamageAmount = weaponmod.damage
local RecoilAmount = weaponmod.recoil
game:GetService("RunService").Heartbeat:Connect(function(dt)
if IsPlayerHoldingMouse then
if canFire then
canFire = false
recoilspring:shove(RecoilAmount)
--coroutine.wrap(function()
--local firesound = gun.WeaponComponents.Sounds.Fire:Clone()
--firesound.Parent = game.Workspace
--firesound.Parent = nil
--firesound:Destroy()
--end)()
castparams = RaycastParams.new()
castparams.IgnoreWater = true
castparams.FilterType = Enum.RaycastFilterType.Exclude
castparams.FilterDescendantsInstances = {viewmodel, game.Players.LocalPlayer.Character}
local mouse = meleemod.GetMouse(1000, castparams)
meleemod.cast(gun, mouse, 60, damage, castparams, DamageAmount, anims, viewmodel)
fire:FireServer(gun, mouse)
wait(del)
canFire = true
end
end
end)
inputser.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
IsPlayerHoldingMouse = true
end
end)
inputser.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
IsPlayerHoldingMouse = false
end
end)
end
Try to add some more print to check if event don’t fire.
function module.equip(viewmodel, gun, hold)
print("Equipped")
local gunhand = gun.WeaponComponents.Handle
local hrpM6D = viewmodel:WaitForChild("HumanoidRootPart").Handle
gun.Parent = viewmodel
hrpM6D.Part1 = gunhand
local Hold = viewmodel.AnimationController:LoadAnimation(hold)
Hold:Play()
-- 3rd Person
local third = game.ReplicatedStorage.Events.Equip3rd
local player = game.Players.LocalPlayer.Name
third:FireServer(gun.Name)
third.OnClientEvent:Connect(function(clone)
print("EventConnected")
for i, v in pairs(clone:GetDescendants()) do
print("Checking Clones")
if v:IsA("Part") or v:IsA("MeshPart") then
print("Transparency!!!")
v.Transparency = 1
end
end
end)
end