local reverb = game.ReplicatedStorage:WaitForChild("Reverb")
script.Parent.Touched:Connect(function(plr)
if plr:IsA("BasePart") then
if plr.Parent:FindFirstChild("HumanoidRootPart") then
plr = game.Players:FindFirstChild(plr)
reverb:FireClient(plr)
end
end
end)
You understand it completely wrong, the Variable in the Touched Function which you named “plr” is the Instance which hits the part. And getting the player by its child isn’t possible, you may add plr = game.Players:FindFirstChild(plr.Parent)
Tell me if it works, because that should probably fix the issue!
One side note, you have to be calling :GetPlayerFromCharacter instead of :FindFirstChild, and you should use game:GetService(“Players”) instead of game.Players
This won’t work because plr is already connected to the function of script.Parent.Touched:Connect(function(plr), and also It doesn’t connects to the player, it supposed to connect to the hit function as well. You have to use the game:GetService("Players) to get the :GetPlayerFromCharacter from the hit function.
local plr = game:GetService("Players")
And for the hit function, I suggest you changing the plr from the function to hit like this:
script.Parent.Touched:Connect(function(hit)
local plr = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
end)
Now, add the remote event by using the if for the plr to check if it’s true or not.
if plr then
reverb:FireClient(plr)
end
Now, the script is finished. Here is the full script:
local reverb = game.ReplicatedStorage:WaitForChild("Reverb")
local players = game:GetService("Players")
script.Parent.Touched:Connect(function(hit)
local plr = players:GetPlayerFromCharacter(hit.Parent)
if plr then
reverb:FireClient(plr)
end
end)
Please note that what I said is probably inaccurate.