- What do you want to achieve?
I have a question about using a function to connect to an event. I want to make a system that teleports players if the player interacts with ProximityPrompt (if anything, I want to simplify the script… So that later I don’t have to put it for each part.). I need the player parameter and all 2 nodes. If the player interacts with a node, then the player will be teleported to another node.
-
What is the issue?
There is a problem with the parameters for theteleportTo()
function. How to correctly make sure that not one parameter is responsible for an action, but all of them? In developer hub there is only one parameter there. I can’t find it on YouTube. -
What solutions have you tried so far?
I’m still looking for a way. I searched on the Internet, but to no avail.
local Castle_Combat = script.Parent.Castle_Combat
local Castle_Training = script.Parent.Castle_Training
local Castle_UG = script.Parent.Castle_UG
local Castle_Zeppelin = script.Parent.Castle_Zeppelin
function teleportTo(Node1 : Instance, Node2 : Instance, player) -- What I need to do?
---I will fill soon.
end
---All "Triggered" events
Castle_Combat.Node1.ProximityPrompt.Triggered:Connect(teleportTo)
Castle_Combat.Node2.ProximityPrompt.Triggered:Connect(teleportTo)
Castle_UG.Node1.ProximityPrompt.Triggered:Connect(teleportTo)
Castle_UG.Node2.ProximityPrompt.Triggered:Connect(teleportTo)