How do I script multiple proximity prompts

I have portals around my game which will send players to different areas. I’m just wondering how to I script multiple proximity prompts In the same script? Btw I am using a local script for this, I’m not sure if a local script or a regular script will be better for this task? Anyways…

I tried putting all of my portals proximity prompts in a dictionary and looping through it but it didn’t work. I also learned about proximity prompt service, should I be using this instead?

Where are you putting your local script?

I put my script in Starter character scripts. It didn’t work then I put it in starter GUI and it didn’t work again.

Well, can you share the script?

Wait if your asking where I usually put my local scripts , I usually put them in starter character, starter player, and starter GUI. Most of the time I put my scripts in starter GUI.

Yes sorry, how do I upload my script though? Do I just paste in what it says here?

Yea, you use the format text button which looks like this </>

local pps = game:GetService("ProximityPromptService")

local destination = workspace.Part

local portals = {
	woodsPortals = {
		zone2 = workspace.zones.zone2.portals.woodsPortal.portal.ProximityPrompt
	},
	rockPortals = {
		startingArea = workspace.startingArea.portals.rockPortal.portal.ProximityPrompt
	},
	mysteryPortals = {
		startingArea = workspace.startingArea.portals.mysteryPortal.portal.ProximityPrompt,
		zone2 = workspace.zones.zone2.portals.mysteryPortal.portal.ProximityPrompt
	}
}



for portals, woodsPortalTriggers in pairs(portals.woodsPortals) do
	woodsPortalTriggers.Triggered:Connect(function(player)
		player.CFrame = destination.CFrame
	end)
end

Why are you changing the player’s CFrame but not the character’s CFrame?

Change this to:

player.Character.HumanoidRootPart.CFrame = destination.CFrame

Oof sorry I’m sorry :disappointed: but am I using dictionaries right? Idk if this is the proper way to get proximity prompts

Yes, you are using dictionaries correctly from my understanding.

It works, thank you :smiley: I just wanted to ask one more thing, Is it better for players to teleport on the client or server?

It is better on the server as its faster and more trustworthy.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.