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)