Hello, dear scripters.
Maybe it is due to recent updates, but I have a little problem.
The first tool is a brick which makes sit every player who touches it. It's the LocalScript which is in the handle:
function onTouch(part)
local humanoid = part.Parent:FindFirstChild("Humanoid")
if (humanoid ~= nil) then
humanoid.Sit = true
end
end
script.Parent.Touched:connect(onTouch)
However, I also have a tool which makes a ray and if it touches anybody, it should make the player sit. The problem is, it does not.
When I make a simulation of a server with two players, I see from the tool user's perspective that the target's humanoid "Sit" value is set to true on the Explorer.
Just when I switch to the target's perspective, its Sit value is set to false value on the Explorer.
If I made the humanoid lose health instead of sitting, however, it will loose health without any problems.
Here is the ray tool LocalScript:
local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
pointing = false
tool.Equipped:connect(function(mouse)
print("Tool equipped!")
mouse.Button1Down:connect(function()
pointing = true
while pointing do
print("Mouse pressed!")
local ray = Ray.new(tool.Aim.CFrame.p, (mouse.Hit.p - tool.Aim.CFrame.p).unit * 300)
local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
local beam = Instance.new("Part", workspace)
beam.BrickColor = BrickColor.new("Bright blue")
beam.FormFactor = "Custom"
beam.Material = "Ice"
beam.Transparency = 0.25
beam.Anchored = true
beam.Locked = true
beam.CanCollide = false
local distance = (tool.Aim.CFrame.p - position).magnitude
beam.Size = Vector3.new(0.3, 0.3, distance)
beam.CFrame = CFrame.new(tool.Aim.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
wait()
beam:Destroy()
if part then
local humanoid = part.Parent:FindFirstChild("Humanoid")
if not humanoid then
humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
end
if humanoid then
humanoid.Sit = true
end
end
end
end)
mouse.Button1Up:connect(function()
pointing = false
end)
end)
The game I am testing this on has Filtering Disabled.
I wish you could help me out.
Thank you.

4 comments
Filtering Disabled is no longer a thing
Filtering disabled is a thing, but no longer used for games.
Well, I think that is an explanation as to why the ray tool is not making a target's humanoid sit down. But the brick tool is, however. So, how to make this ray tool work?
:connect is depricated use :Connect line 8 , 5 and 46