Help someone. Filtering is enabled and I've tried to pass on the mouse from the local script but it just isn't working. Anyone have any ideas because I'm desperate.
-- Local Script
Player = game.Players.LocalPlayer
mouse = Player:GetMouse()
anim = game.ReplicatedStorage.Caught
script.Parent.Equipped:connect(function()
mouse.Button1Down:connect(function()
script.Parent.RemoteEvent:FireServer(mouse,anim)
end)
end)
-- Script
script.Parent.RemoteEvent.OnServerEvent:connect(function(Player,mouse,anim)
if mouse.Target ~= nil then
local Hit = mouse.Target
if Hit.Name == ("Torso") or Hit.Name == ("Head") or Hit.Name == ("Left Leg") or Hit.Name == ("Right Leg") or Hit.Name == ("HumanoidRootPart") or Hit.Name == ("Left Arm") or Hit.Name == ("Right Arm") then
local Jailed = Hit.Parent
local Jailed2 = Jailed.Torso
local Jailed1 = Player.Character.Torso
local attachmentB = Instance.new("Attachment",Jailed2)
local attachmentA = Instance.new("Attachment",Jailed1)
attachmentA.CFrame = CFrame.new(1,-0.7,0.3)
attachmentB.CFrame = CFrame.new(0,0,0.3)
local ropeConstraint = Instance.new("RopeConstraint",Jailed1)
ropeConstraint.Attachment0 = attachmentA
ropeConstraint.Attachment1 = attachmentB
ropeConstraint.Length = 10
ropeConstraint.Visible = true
ropeConstraint.Color = BrickColor.Black()
ropeConstraint.Thickness = 0.2
ropeConstraint.Restitution = 0.5
local caught = Jailed.Humanoid:LoadAnimation(anim)
caught:Play()
script.Parent.Unequipped:connect(function()
ropeConstraint:Destroy()
caught:Stop()
end)
end end
end)

5 comments
On the player variable add, or game.Players.PlayerAdded:Wait()
Plus connect is depricated, use Connect
does not matter.
https://scriptinghelpers.org/questions/44905/attempt-to-index-local-mouse-a-nil-value
I fixed it anyway, thank you