local replicatedStorage = game:GetService("ReplicatedStorage") local weaponRemoteEvents = replicatedStorage.remoteEvents.weaponRemoteEvents weaponRemoteEvents.shootEvent.OnServerEvent:Connect(function(player, mousePos, bulletTravelDistance, toolHandle, damage, toolName) local rayParams = RaycastParams.new() rayParams.FilterDescendantsInstances = {player.Character} rayParams.FilterType = Enum.RaycastFilterType.Blacklist local ray = workspace:Raycast(toolHandle.CFrame.p, (mousePos - toolHandle.CFrame.p) * bulletTravelDistance, rayParams) if ray then local model = ray.Instance:FindFirstAncestorOfClass("Model") if model then if model:FindFirstChild("Humanoid") then model.Humanoid.Health -= damage end end end end)
Here is the code for the gun. I've tried so many ways to get a working visualizer but I just can't seem to get it to work. Please help. Also here are what the params are:
player = local player mousePos = player:GetMouse().Hit bulletTravelDistance = 300 toolHandle = toolHandle part damage = 10 toolName = ar
Look up everything that you don't know how to do
the second thing Is maybe :Lerp 0.5 or something