You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Getting rid of this error -
What is the issue? Include screenshots/videos if possible!
When I click to fire the ClickDectector in the Part, it gives me this error for both buttons:
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried fixing it by adding in:
local CurrentScannedPlayer = script.Parent.Parent.Parent:WaitForChild("CurrentScannedPlayer")
But it didn’t fix it, I even fixed the Parent in the scripts.
Script 1:
local DB = false
script.Parent.ClickDetector.MouseClick:Connect(function(Player)
if Player.TeamColor == BrickColor.new("Bright red") then
if DB == false then
DB = true
local CurrentScannedPlayer = script.Parent.Parent.Parent:WaitForChild("CurrentScannedPlayer")
game:GetService("ReplicatedStorage"):WaitForChild("Remotes"):WaitForChild("BorderControl"):FireAllClients("RIGHTDOOR","Open")
local P = game.Players:FindFirstChild(script.Parent.CurrentScannedPlayer.Value)
game:GetService("ReplicatedStorage"):WaitForChild("Remotes").ShowNotif2:FireClient(P,"BORDER","You have successfully crossed!")
for i,v in pairs(game.Workspace["Border Controls"].Screen.SurfaceGui.ScrollingFrame:GetChildren()) do
if v:IsA("TextLabel") and v.Name ~= "EX" then
v:Destroy()
end
end
script.Parent.Parent.Parent.CurrentScannedPlayer.Value = "None"
wait(2.5)
DB = false
end
end
end)
Script 2:
local DB = false
script.Parent.ClickDetector.MouseClick:Connect(function(Player)
if Player.TeamColor == BrickColor.new("Bright red") then
if DB == false then
DB = true
local CurrentScannedPlayer = script.Parent.Parent.Parent:WaitForChild("CurrentScannedPlayer")
local P = game.Players:FindFirstChild(script.Parent.CurrentScannedPlayer.Value)
local Character = P.Character
Character.HumanoidRootPart.CFrame = script.Parent.Parent.Parent.BACKTP.CFrame
game:GetService("ReplicatedStorage"):WaitForChild("Remotes").ShowNotif2:FireClient(P,"BORDER","You have denied access!")
for i,v in pairs(game.Workspace["Border Controls"].Screen.SurfaceGui.ScrollingFrame:GetChildren()) do
if v:IsA("TextLabel") and v.Name ~= "EX" then
v:Destroy()
end
end
script.Parent.Parent.Parent.CurrentScannedPlayer.Value = "None"
wait(2.5)
DB = false
end
end
end)
Hiearchy:


