Disclaimer
I am new to scripting and been teaching myself through Dev forum, Roblox dev, and Youtube tutorials.
I always try to look and I usually find an answer, but couldn’t this time.
- What do I want to achieve?
I want to be able to add a function to a proximityprompt that is located inside of
another player and activates when “player a” triggers “player b” proximityprompt.
(The proximityprompt is inside of their humanoidrootpart)
(The RemoteEvent is in ReplicatedStorage)
(The Local Script is in StarterPlayerScripts)
- What is the issue? Video below
The issue I am having is that I don’t know how to locate the proximityprompt inside of another player in the game or how to tell when “player a” triggers “player b” proximityprompt.
https://gyazo.com/7c519b975b2b603466cbf67d030a4d1e
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve look on Developer Hub already and to no avail I found nothing.
I used a remote function for when the player triggers the proximityprompt it will simply print “Hey Server” and the server would print “Hey Client”. However when I go to test, absolutely nothing happens. I don’t get any errors in output. I believe that it has to do with the fact that I’m not getting the right proximityprompt, but I’m not sure.
Both my Local and Server script below
(Server Script)
local replicatedStorage = game:GetService("ReplicatedStorage")
local ContactPlayerRemote = replicatedStorage:WaitForChild("ContactPlayer")
local function proximityPromptTrigger(player)
print("Hey Client")
end
ContactPlayerRemote.OnServerEvent:Connect(proximityPromptTrigger)
(Local Script)
local replicatedStorage = game:GetService("ReplicatedStorage")
local proximityPrompt = replicatedStorage:WaitForChild("ProximityPrompt")
local ContactPlayerRemote = replicatedStorage:WaitForChild("ContactPlayer")
ProxmityPrompt.Triggered:Connect(function()
print("Hey Server")
ContactPlayerRemote:FireServer(player)
end)
Summary
I just want to know how to get the other player’s proximityprompt (which I don’t know how to script), and how to let the server know when “player a” trigger “player b” proximityprompt.
This is my first post ever, so sorry in advance if I make mistakes. I don’t know how to go on about this, but I do appeciate all support!