local function NotSoDooDoo(KanyeWest)
print("fein")
end
local function DooDoo(greenfn, poop)
local ProximityIsKey = Instance.new("ProximityPrompt")
ProximityIsKey.HoldDuration = 2
ProximityIsKey.Parent = greenfn
ProximityIsKey.ActionText = "Goon"
if poop == "One" then
greenfn.Humanoid:MoveTo(ConcessionLine:FindFirstChild("Cashier1").Position)
greenfn.Humanoid.MoveToFinished:Wait()
greenfn.HumanoidRootPart.Orientation = Vector3.new(0,90,0)
else if poop == "Two" then
greenfn.Humanoid:MoveTo(ConcessionLine:FindFirstChild("Cashier2").Position)
greenfn.Humanoid.MoveToFinished:Wait()
greenfn.HumanoidRootPart.Orientation = Vector3.new(0,0,0)
end
end
ProximityIsKey.Triggered:Connect(NotSoDooDoo(ProximityIsKey))
end
The reason why I want a parameter passed is because in the function I want to :Destroy() the ProximityPrompt. (Ignore my brainrot)
You cannot directly pass parameters into the Connect function of an RBXScriptSignal. You will have to create a new function that will call your function with your own parameters:
local function triggered(proximityPrompt, player)
if proximityPrompt == openDoor then
-- do stuff
end
end
openDoor.Triggered:Connect(function(player)
triggered(openDoor, player)
end)
When you do Connect(foo(...)), what you are actually doing is calling the function foo and connecting whatever that function returns, whatever that may be.
local function foo(a)
return a
end
proximityPrompt.Triggered:Connect(foo(1))
-- incorrect usage. equivalent to:
proximityPrompt.Triggered:Connect(1)
-- giving you an error of:
-- Attempt to connect failed: Passed value is not a function
For you guys that care this is what I decided to do:
local function DooDoo(greenfn, poop)
local ProximityIsKey = Instance.new("ProximityPrompt")
ProximityIsKey.HoldDuration = 2
ProximityIsKey.Parent = greenfn
ProximityIsKey.ActionText = "Goon"
if poop == "One" then
greenfn.Humanoid:MoveTo(ConcessionLine:FindFirstChild("Cashier1").Position)
greenfn.Humanoid.MoveToFinished:Wait()
greenfn.HumanoidRootPart.Orientation = Vector3.new(0,90,0)
else if poop == "Two" then
greenfn.Humanoid:MoveTo(ConcessionLine:FindFirstChild("Cashier2").Position)
greenfn.Humanoid.MoveToFinished:Wait()
greenfn.HumanoidRootPart.Orientation = Vector3.new(0,0,0)
end
end
ProximityIsKey.Triggered:Connect(function()
ProximityIsKey:Destroy()
end)
end