Trying to open a GUI whenever the proximity prompt is clicked and yet the Proximity prompt is not working nor printing.
prompt.Triggered:Connect(function(Player)
local AIOptions = game.ReplicatedStorage.AIOption:Clone()
AIOptions.Enabled = true
AIOptions.Parent = Player.PlayerGui
print("SHOULDVEWORKED")
AIOptions.Menu1.Emotes.Hands.Botao.MouseButton1Click:Connect(function()
local r = randomChats[math.random(1, #randomChats)]
game:GetService("Chat"):Chat(head, r, "Blue")
while Detained do
wait(1)
local TargetHumanoid = script.Parent:WaitForChild('Humanoid')
local HRP = Player.Character.HumanoidRootPart
TargetHumanoid.WalkSpeed = 10
--TargetHumanoid.WalkToPart = HRP
--TargetHumanoid.WalkToPoint = HRP.Position
--TargetHumanoid:MoveTo(HRP.Position, HRP)
local goal = HRP.Position
local path = game:GetService("PathfindingService"):CreatePath()
path:ComputeAsync(torso.Position, goal)
local waypoints = path:GetWaypoints()
if path.Status == Enum.PathStatus.Success then
for _, waypoint in pairs(waypoints) do
if waypoint.Action == Enum.PathWaypointAction.Jump then
TargetHumanoid.Jump = true
end
TargetHumanoid:MoveTo(waypoint.Position)
TargetHumanoid.MoveToFinished:Wait()
end
else
TargetHumanoid:MoveTo(HRP.Position)
end
end
end)
end)