In my game, I'm working on making it work with filtering enabled. The issue is however, that this script can't detect haul which is defined on line 9, even though it's in the workspace. I don't know what is causing the connection error and can't seem to figure another way of doing this. If anyone could tell me why Haul won't connect, I would be very thankful. Here is the server script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local colorChangeEvent = ReplicatedStorage:WaitForChild("Release")
local active = false
local function press(player, x)
wait()
local plr = player
local char = player.Character
local haul = char:findFirstChild("Haul")
char.Latched.Value = false
if haul.Value.Parent.Primary.Value == char then
if haul.Value.Parent.Players.Number.Value > 1 then
local torch = 1
local max = haul.Part0.Parent.Players.Max.Value
repeat
local num = haul.Part0.Parent.Players:findFirstChild(torch)
if num == nil then
torch = torch + 1
end
if num ~= nil then
haul.Value.Parent.Primary.Value = num
num.Value.Humanoid.WalkSpeed = char.Humanoid.WalkSpeed
num.Value.Humanoid.JumpPower = char.Humanoid.JumpPower
num.Humanoid.PlatformStand = false
end
until num ~= nil or torch == max
else
haul.Value.Parent.Primary.Value = nil
end
else
local c = haul.Value.Parent.Players:GetChildren()
for index, item in pairs(c) do
if item:IsA("ObjectValue") and item.Value == char then
item:remove()
end
end
end
haul.Value.Parent.Strength.Value = haul.Value.Parent.Strength.Value - char.Strength.Value
haul.Value.Parent.Players.Number.Value = haul.Value.Parent.Players.Number.Value - 1
haul.Value.Haul.Part0 = nil
char.Humanoid.WalkSpeed = char.plrSpeed.Value
char.Humanoid.JumpPower = char.plrJump.Value
char.Humanoid.PlatformStand = false
wait(.5)
char.plrJump:remove()
char.plrSpeed:remove()
haul.Value.Haul.Part1 = nil
haul.Value.Taken.Value = false
haul.Value.Haul:remove()
haul:remove()
end
colorChangeEvent.OnServerEvent:Connect(press)
And here is the client script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local colorChangeEvent = ReplicatedStorage:WaitForChild("Release")
plr = script.Parent.Parent.Parent.Parent.Parent.Parent
debounce = false
function buy()
colorChangeEvent:FireServer()
script.Parent.Parent.Selectable = false
script.Parent.Parent.Visible = false
end
script.Parent.MouseButton1Down:connect(buy)

8 comments
Just capitalize the “f” in “:FindFirstChild()”?
That's not the problem I'm afraid... I use it that way all the time for other scripts and they all work fine, so something else is up...
Does the script return any errors in the output?
I'm confused by this code. Can you explain what is "haul.Value.Parent.Primary.Value"? Do you have objects named 'Value' and 'Parent'? That is probably not the best idea, as parent refers to the object's parent already! So 'haul.Value.Parent' is really just 'haul', if 'Value' is even an object and not a property like the 'Value' at the end.
Haul is an object value, so haul.Value.Parent is referring to the parent of the object that is specified in haul. It's a bit confusing but it does work. Also, it does send back errors. They only say however, that haul is a nil value. Another thing to note however is that the script runs fine on test mode, meaning that the problem is simply with the client and server communicating.
Line 34 change remove to Destroy. Stay up to date and listen to Denny. Scripting is case sensitive. And on line 33 change to if item.ClassName == "ObjectValue" then, because anything can inherit from objectvalue.
And also at the very last line, change :connect to :Connect
I think I found a problem in another script actually. It seems that the errors from this one hadn't been mistakes because it seems that the scripts setting up the haul have broken. I'm very sorry about that...