Hello, I am creating a Capture the flag system that uses Events & remotes as well as Proximity Prompts to function.
I am having an issue getting the proximity prompts to show when a player is nearby,
I am willing to hire a scripter if required to assist with this.
Expectations:
I am expecting the Proximity Prompts to show up on the flag handles based on some arguments
If the player Is red team and does not have a flag then Capture Prompt will show on the Blue Flag,
If a player is a red team and has a flag model inside the person then the Red Flag would say Deposit Flag Prompt, I did have it working like this but the code was bugged and would not send server-specific commands.
The Ideal function would be for the proximity prompt to only show for the local player while following the above function based on location to the flag, team & if they have a flag model on their person.
Flag Module Code
-- Flag Event Receiver that makes the changes to the Proximity Prompts
-- Proximity Prompts are located in Workspace > Game > Core > Flags > Red_Flag > Handle
-- this script is located in ReplicatedStorage > Storage > Modular_Script > Flag_Events
https://github.com/TheTechnologyStudio/Roblox-Capture-The-Flag/blob/main/ReplicatedStorage%20%7C%20Storage%20%7C%20Modular_Scripts%20%7C%20Flag_Events/Flag_Prompt_Receiver
StarterPlayerScripts Function Call Script
-- Main script that calls functions from the local player and identifies player location
https://github.com/TheTechnologyStudio/Roblox-Capture-The-Flag/blob/main/StarterPlayerScripts/Flag_Controller_Script
Some Photos of the Flag Structures
Any help would be greatly appreciated, I am still new to scripting.
Hello there,
First you will want to disable the proximity prompt by default. Do this by setting enabled to false.
Then your code should use the TeamsService and an “if” statement to check the players team. You should note that you cannot do game.Players.LocalPlayer in a server script.
So, instead you would use:
player = game:GetService(“Players”).PlayerAdded:Wait()
If you’re using a local script, it doesn’t matter.
Then check the players team with an if statement. An if statement basically checks if something is true and if it is the code runs. For example:
if A == B then
-code here
else
-code here
end
You will be using the if statement to detect which team the player is on. Then, add another if statement checking whether or not they have the flag yet. In order to detect if the flag is on them you need to know where it gets parented when they collect it. If its the players character just check if theres a child, using FindFirstChild, that is named whatever the flags name is
If both statements are true enable the proximity promt!
If you want to add it based on how close the player is then go to the proximity promt properties and change display distance or something like that
Hope this helps
Hello Scary,
Thank you for the information you provided, I already knew all of this and I’m not sure if you read the GitHub links I provided in the original post but all of that was already coded in.
https://github.com/TheTechnologyStudio/Roblox-Capture-The-Flag/blob/main/ReplicatedStorage%20%7C%20Storage%20%7C%20Modular_Scripts%20%7C%20Flag_Events/Flag_Prompt_Receiver
https://github.com/TheTechnologyStudio/Roblox-Capture-The-Flag/blob/main/StarterPlayerScripts/Flag_Controller_Script
My main issue is, I need help creating the Event function to convert the local script function to the game function
No i did not the read the links, sorry.