eMisakie
(emisakie)
January 18, 2023, 2:04am
#1
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?
hasoco
(kan ye)
January 18, 2023, 2:12am
#2
Where are you putting your local script?
eMisakie
(emisakie)
January 18, 2023, 2:14am
#3
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.
hasoco
(kan ye)
January 18, 2023, 2:15am
#4
Well, can you share the script?
eMisakie
(emisakie)
January 18, 2023, 2:15am
#5
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.
eMisakie
(emisakie)
January 18, 2023, 2:16am
#6
Yes sorry, how do I upload my script though? Do I just paste in what it says here?
hasoco
(kan ye)
January 18, 2023, 2:16am
#7
Yea, you use the format text button which looks like this </>
eMisakie
(emisakie)
January 18, 2023, 2:20am
#8
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
hasoco
(kan ye)
January 18, 2023, 2:27am
#9
Why are you changing the player’s CFrame but not the character’s CFrame?
Change this to:
player.Character.HumanoidRootPart.CFrame = destination.CFrame
eMisakie
(emisakie)
January 18, 2023, 2:29am
#10
Oof sorry I’m sorry but am I using dictionaries right? Idk if this is the proper way to get proximity prompts
hasoco
(kan ye)
January 18, 2023, 2:29am
#11
Yes, you are using dictionaries correctly from my understanding.
eMisakie
(emisakie)
January 18, 2023, 2:41am
#12
It works, thank you I just wanted to ask one more thing, Is it better for players to teleport on the client or server?
hasoco
(kan ye)
January 18, 2023, 2:42am
#13
It is better on the server as its faster and more trustworthy.
system
(system)
Closed
February 1, 2023, 2:42am
#14
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.