SO I have been using proximity prompts for my game, however, it just completely breaks and won’t work when I trigger it.
I Have a script that is in charge of when it is triggered, however, the only times it does work is if I’m in first person, which is a little bit weird.
I have been looking a bit around and some say it has something to do with the camera subject, but I am not sure how to fix that. Currently, I have a menu for my game that changes the camera subject every time they leave the menu.
The script is located shown below:
Is there any way to get it to trigger when I am not in first person?
Do you mean the prompt thing does not even show up? Try unticking RequiresLineOfSight
in the properties of the prompt.
My problem is that Triggered won’t work some times, I have unticked the RequiresLineOfSight property.
Can you send the script please? It’s hard to help without it.
local idleAnim = Instance.new("Animation")
idleAnim.AnimationId = "rbxassetid://17368963367"
local CleaningAnim = Instance.new("Animation")
CleaningAnim.AnimationId = "rbxassetid://17369012502"
local cleanTrack = script.Parent.Humanoid.Animator:LoadAnimation(CleaningAnim)
cleanTrack:Play()
local proximityPrompt = script.Parent:WaitForChild("HumanoidRootPart").Attachment:WaitForChild("ProximityPrompt")
local ServerDialogue = require(game.ServerScriptService.QuestSystem.ServerDialogue)
print(proximityPrompt)
proximityPrompt.Triggered:Connect(function(plr)
print("triggered")
if proximityPrompt.Enabled == false then return end
print("running")
proximityPrompt.Enabled = false
cleanTrack:Stop()
local idleTrack = script.Parent.Humanoid.Animator:LoadAnimation(idleAnim)
idleTrack.Looped = true
idleTrack:Play()
-- rest of my script here
idleTrack:Stop()
cleanTrack = script.Parent.Humanoid.Animator:LoadAnimation(CleaningAnim)
cleanTrack:Play()
proximityPrompt.Enabled = true
end)
Is it because the ProximetyPrompt is inside the HumanoidRootPart?
Just for testing try putting it into the player’s arm, or a Part that’s welded to the player.
Also, shouldn’t you load the animations at the beginning of the script rather than doing it each time you change them during the script?
Hello I have placed it inside the players head now, and it seems to make no difference at all. Nothing is working still.
Would it be best to create a different way of interacting with npc’s?